Untitled

 avatar
unknown
plain_text
2 years ago
1.4 kB
6
Indexable
			Pass {
				ZTest LEqual

				CGPROGRAM
				#pragma vertex vert
				#pragma fragment frag

				#include "UnityCG.cginc"
				#include "Navmesh.cginc"

				float4 _Color;
				float _PixelWidth;

				// Number of screen pixels that the _Falloff texture corresponds to
				static const float FalloffTextureScreenPixels = 2;

				line_v2f vert(appdata_color v, out float4 outpos : SV_POSITION) {
					line_v2f o = line_vert(v, _PixelWidth, outpos);
					o.col = v.color * _Color;
					//half3 worldNormal = UnityObjectToWorldNormal(v.normal);
					//o.col.rbg = worldNormal * 0.5 + 0.5;
					if (!IsGammaSpaceCompatibility()) {
						o.col.rgb = GammaToLinearSpace(o.col.rgb);
					}
					return o;
				}

				half4 frag(line_v2f i, UNITY_VPOS_TYPE screenPos : VPOS) : COLOR {
					float2 p = (i.screenPos.xy / i.screenPos.w) - (i.originScreenPos.xy / i.originScreenPos.w);
					// Handle DirectX properly. See https://docs.unity3d.com/Manual/SL-PlatformDifferences.html
					p.y *= _ProjectionParams.x;
					float dist = dot(p * _ScreenParams.xy, i.normal) / _PixelWidth;
					float FalloffFractionOfWidth = FalloffTextureScreenPixels / (_PixelWidth * 0.5);
					float a = lineAA((abs(dist * 4) - (1 - FalloffFractionOfWidth)) / FalloffFractionOfWidth);
					//i.col.rgb = float3(0,i.normal.x, i.normal.y) * 0.5 + 0.5;

					return i.col * float4(1,1,1,1);
				}
				ENDCG
			}
Editor is loading...