Advertisement
Guest User

Normal Masking

a guest
Jun 23rd, 2016
502
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Shader "Normal Masking" {
  2. Properties {
  3. _Col1 ("Color 1", Color) = (1,1,1,1)
  4. _Col2 ("Color 2", Color) = (0,0,0,1)
  5. }
  6. SubShader {
  7. Tags { "RenderType" = "Opaque" }
  8. CGPROGRAM
  9. #pragma surface surf Lambert
  10. struct Input {
  11. float4 color : COLOR;
  12. float3 worldNormal;
  13. };
  14. float3 _Col1;
  15. float3 _Col2;
  16. void surf (Input i, inout SurfaceOutput o) {
  17. float3 normal = i.worldNormal;
  18. float normalMask = normal.x + normal.y + normal.z;
  19. o.Emission = _Col1 * normalMask + _Col2 * (1-normalMask);
  20. }
  21. ENDCG
  22. }
  23. Fallback "Diffuse"
  24. }
Advertisement
RAW Paste Data Copied
Advertisement