Advertisement
tonynogo

Demo 18 - Flatten an model

Jul 6th, 2017
4,384
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Shader "Custom/Flatten" {
  2.     Properties {
  3.         _MainTex ("Base (RGB)", 2D) = "white" {}
  4.         _Elevation ("Elevation", Range(1, 0)) = 0
  5.     }
  6.     SubShader {
  7.         Tags { "RenderType"="Opaque" }
  8.        
  9.         CGPROGRAM
  10.         #pragma surface surf Lambert vertex:vert
  11.  
  12.         sampler2D _MainTex;
  13.         fixed _Elevation;
  14.         struct Input {
  15.             float2 uv_MainTex;
  16.         };
  17.  
  18.         void vert(inout appdata_full v) {
  19.             v.vertex.y = v.vertex.y - (1 + v.vertex.y) * _Elevation;
  20.         }
  21.  
  22.         void surf (Input IN, inout SurfaceOutput o) {
  23.             half4 c = tex2D (_MainTex, IN.uv_MainTex);
  24.             o.Albedo = c.rgb;
  25.         }
  26.         ENDCG
  27.     }
  28.     FallBack "Diffuse"
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement