Created
September 8, 2020 13:41
-
-
Save RamType0/d1e47683709c4d70e76c1988b6a0d32b to your computer and use it in GitHub Desktop.
ワイヤーフレームシェーダー
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Shader "RamType0/Wireframe" | |
| { | |
| Properties | |
| { | |
| _Color("Color",Color) = (0,1,1,1) | |
| } | |
| SubShader | |
| { | |
| Tags { "RenderType"="Opaque" "Queue" = "AlphaTest+275" } | |
| LOD 100 | |
| Pass | |
| { | |
| Name "Wireframe" | |
| CGPROGRAM | |
| #pragma vertex vert | |
| #pragma geometry geom | |
| #pragma fragment frag | |
| // make fog work | |
| #pragma multi_compile_fog | |
| #include "UnityCG.cginc" | |
| struct appdata | |
| { | |
| float4 vertex : POSITION; | |
| }; | |
| struct v2f | |
| { | |
| UNITY_FOG_COORDS(1) | |
| float4 vertex : SV_POSITION; | |
| }; | |
| fixed4 _Color; | |
| v2f vert (appdata v) | |
| { | |
| v2f o; | |
| o.vertex = UnityObjectToClipPos(v.vertex); | |
| UNITY_TRANSFER_FOG(o,o.vertex); | |
| return o; | |
| } | |
| [maxvertexcount(6)] | |
| void geom(triangle v2f input[3], inout LineStream<v2f> stream) | |
| { | |
| stream.Append(input[0]); | |
| stream.Append(input[1]); | |
| stream.RestartStrip(); | |
| stream.Append(input[1]); | |
| stream.Append(input[2]); | |
| stream.RestartStrip(); | |
| stream.Append(input[2]); | |
| stream.Append(input[0]); | |
| stream.RestartStrip(); | |
| } | |
| fixed4 frag(v2f i) : SV_Target | |
| { | |
| fixed4 col = _Color; | |
| UNITY_APPLY_FOG(i.fogCoord, col); | |
| return col; | |
| } | |
| ENDCG | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment