Advertisement
tonynogo

Demo 06 - Customizable Bump

Jul 6th, 2017
3,071
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Shader "Custom/Customizable Bump" {
  2.     Properties {
  3.         _MainTex ("Base (RGB)", 2D) = "white" {}
  4.         _Bump ("Normal map", 2D) = "bump" {}
  5.         _Intensity ("Intensity", Range(-5,5)) = 0.0
  6.     }
  7.     SubShader {
  8.         Tags { "RenderType"="Opaque" }
  9.        
  10.         CGPROGRAM
  11.         #pragma surface surf Lambert
  12.  
  13.         sampler2D _MainTex;
  14.         sampler2D _Bump;
  15.         float _Intensity;
  16.  
  17.         struct Input {
  18.             float2 uv_MainTex;
  19.             float2 uv_Bump;
  20.         };
  21.  
  22.         void surf (Input IN, inout SurfaceOutput o) {
  23.             half4 c = tex2D (_MainTex, IN.uv_MainTex);
  24.             fixed3 n = UnpackNormal(tex2D(_Bump, IN.uv_Bump));
  25.             n.x *= _Intensity;
  26.             n.y *= _Intensity;
  27.             o.Normal = normalize(n);
  28.             o.Albedo = c.rgb;
  29.             o.Alpha = c.a;
  30.         }
  31.         ENDCG
  32.     }
  33.     FallBack "Diffuse"
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement