diff options
| author | yum <yum.food.vr@gmail.com> | 2026-01-13 19:52:38 -0800 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2026-01-13 19:57:02 -0800 |
| commit | 6df5a9a34d81d1200231b974fcc85f89e80eb63e (patch) | |
| tree | 66d6388a3f94acd6929bd23858c3fc01fe8430d6 /Impostor.shader | |
| parent | 8c3a05445f529c10ebbf5bfdc0eb220fe95c558c (diff) | |
Impostors: implement simple grid snapped impostor particle
Diffstat (limited to 'Impostor.shader')
| -rw-r--r-- | Impostor.shader | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/Impostor.shader b/Impostor.shader new file mode 100644 index 0000000..1dff6c9 --- /dev/null +++ b/Impostor.shader @@ -0,0 +1,60 @@ +Shader "yum_food/Gimmicks/Impostors" +{ + Properties + { + _ImpostorAtlas("Impostor Atlas", 2D) = "white" {} + _GridResolution("Grid Resolution", Int) = 5 + _Cutoff("Alpha Cutoff", Range(0, 1)) = 0.5 + _Color("Tint", Color) = (1, 1, 1, 1) + + [Toggle] _DebugMode("Debug Mode", Float) = 0 + + [Enum(UnityEngine.Rendering.CullMode)] _Cull("Cull", Float) = 0 + [Enum(Off, 0, On, 1)] _ZWrite("ZWrite", Int) = 1 + } + + SubShader + { + Tags { "RenderType" = "TransparentCutout" "Queue" = "AlphaTest" } + + Pass + { + Name "FORWARD" + Tags { "LightMode" = "ForwardBase" } + + Cull [_Cull] + ZWrite [_ZWrite] + + CGPROGRAM + #pragma target 3.0 + #pragma vertex vert + #pragma fragment frag + #pragma multi_compile_fog + #pragma multi_compile_instancing + + #include "impostor.cginc" + ENDCG + } + + Pass + { + Name "SHADOW" + Tags { "LightMode" = "ShadowCaster" } + + Cull [_Cull] + + CGPROGRAM + #pragma target 3.0 + #pragma vertex vert + #pragma fragment frag + #pragma multi_compile_shadowcaster + #pragma multi_compile_instancing + + #define IMPOSTOR_SHADOW_PASS + #include "impostor.cginc" + ENDCG + } + } + + FallBack "Transparent/Cutout/Diffuse" +} |
