Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Spherical Map Reflection Surface Shader

Discussion in 'Shaders' started by Emre, May 7, 2013.

  1. Emre

    Emre

    Joined:
    Jul 8, 2012
    Posts:
    21
    Hey guys,

    How can I write this shader as a surface shader?

    Code (csharp):
    1.  
    2. Shader "Custom/Reflective"
    3. {
    4.    Properties
    5.    {
    6.      _EnvMap("EnvMap", 2D) = "black" {TexGen SphereMap}
    7.    }
    8.    
    9.    SubShader
    10.    {
    11.      SeparateSpecular On
    12.           Pass
    13.           {
    14.               Name "BASE"
    15.               ZWrite on
    16.               Blend One One
    17.               BindChannels {
    18.               Bind "Vertex", vertex
    19.               Bind "normal", normal
    20.           }
    21.    
    22.          SetTexture [_EnvMap]
    23.          {
    24.               combine texture
    25.          }
    26.       }
    27.    }
    28.    Fallback "Diffuse"
    29. }
    30.  
     
unityunity