Last active
November 18, 2020 09:52
-
-
Save lyuma/c5cd4f031e45210e9cf96dc685c7d229 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
| /* | |
| Original file : | |
| Storage for distribution - Lyuma | |
| https://gist.github.com/lyuma | |
| rounded_trail for quest | |
| LICENSE : CC0 | |
| */ | |
| // 2019-09-30 customized for quest. | |
| Shader "Unlit/trail_customized_quest" | |
| { | |
| Properties | |
| { | |
| _Color ("Solid Color", Color) = (1,1,1,1) | |
| _InvisibleDistance ("Invisible Distance from Camera", Float) = 500.0 | |
| } | |
| SubShader | |
| { | |
| Tags { "Queue"="AlphaTest" "RenderType"="Opaque" } | |
| LOD 100 | |
| Cull Back | |
| Blend One Zero | |
| ZWrite On | |
| Pass | |
| { | |
| CGPROGRAM | |
| #pragma vertex vert | |
| #pragma fragment frag | |
| #pragma multi_compile_fog | |
| #pragma target 3.0 | |
| #include "UnityCG.cginc" | |
| struct appdata | |
| { | |
| float4 vertex : POSITION; | |
| float2 uv : TEXCOORD0; | |
| }; | |
| struct v2f | |
| { | |
| float4 vertex : SV_POSITION; | |
| float2 uv : TEXCOORD0; | |
| }; | |
| sampler2D _MainTex; | |
| float4 _Color; | |
| float _InvisibleDistance; | |
| #ifdef USING_STEREO_MATRICES | |
| static float3 centerEyePos = 0.5 * (unity_StereoWorldSpaceCameraPos[0] + unity_StereoWorldSpaceCameraPos[1]); | |
| #else | |
| static float3 centerEyePos = _WorldSpaceCameraPos; | |
| #endif | |
| v2f vert (appdata v) | |
| { | |
| v2f o; | |
| o.vertex = UnityObjectToClipPos(v.vertex); | |
| if (distance(mul(unity_ObjectToWorld, v.vertex).xyz, centerEyePos.xyz) > _InvisibleDistance) { | |
| o.vertex = 0./0.; | |
| } | |
| o.uv = v.uv; | |
| return o; | |
| } | |
| fixed4 frag (v2f i) : SV_Target | |
| { | |
| float l = length(i.uv); | |
| return float4(_Color.xyz,1); | |
| } | |
| ENDCG | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment