duck

Simple Planar Overhead Shadow Shader

Jul 21st, 2014
355
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. Shader "Simple Planar Overhead Shadow" {
  2. Properties {
  3. _Color ("Color", Color) = (0,0,0,0)
  4. _GroundHeight ("Ground Height", Float) = 0
  5. }
  6. SubShader {
  7. Tags { "RenderType" = "Opaque" }
  8. CGPROGRAM
  9. #pragma surface surf Lambert vertex:vert
  10. struct Input {
  11. float2 uv_MainTex;
  12. };
  13. float4 _Color;
  14. float _GroundHeight;
  15.  
  16. void vert (inout appdata_full v) {
  17. // transform into worldspace
  18. float4 world_space_vertex = mul( _Object2World, v.vertex );
  19.  
  20. world_space_vertex.y = _GroundHeight;
  21.  
  22. // transform back into local space
  23. v.vertex = mul( _World2Object, world_space_vertex );
  24.  
  25. }
  26.  
  27. void surf (Input IN, inout SurfaceOutput o) {
  28. o.Albedo = _Color;
  29. }
  30. ENDCG
  31. }
  32. Fallback "Diffuse"
  33. }
Advertisement
Add Comment
Please, Sign In to add comment