Search Unity

Shader gone wrong

Discussion in 'Shaders' started by fffMalzbier, Sep 3, 2013.

  1. fffMalzbier

    fffMalzbier

    Joined:
    Jun 14, 2011
    Posts:
    3,276
    Hallo everyone.
    I just ported my project form 3.5 to 4.2 and it looks like my shader is doing weird things.

    What the shader should do: reflective - > Qubemap with rim fallof
    What it does : Shows the world norma.

    Is there anything changed in the shader code that this shader breaks?
    Thanks for any hints or tips.

    Code (csharp):
    1.  
    2. Shader "Capture/QubeMap Reflection Vertex Lit" {
    3.     Properties {  
    4.       _Color ("Main Color, Alpha", Color) = (1,1,1,1)
    5.       _MainTex ("Texture", 2D) = "white" {}  
    6.       _Cube ("Cubemap", CUBE) = "" {}
    7.       _Reflection ("Rim Power", Range(0,1)) = 1
    8.     }  
    9.     SubShader {  
    10.       Tags { "RenderType" = "Opaque" "LightMode" = "Vertex" }  
    11.       CGPROGRAM  
    12.       #pragma surface surf Lambert  
    13.       struct Input {  
    14.           float2 uv_MainTex;  
    15.           float3 worldRefl;
    16.           float3 viewDir;
    17.       };  
    18.       sampler2D _MainTex;  
    19.       samplerCUBE _Cube;
    20.       float _Reflection;
    21.       float4 _Color;
    22.       void surf (Input IN, inout SurfaceOutput o) {  
    23.           o.Albedo = tex2D (_MainTex, IN.uv_MainTex).rgb * 0.5;
    24.           o.Albedo *= _Color.rgb;
    25.           o.Emission = _Reflection * texCUBE (_Cube , IN.worldRefl).rgb;
    26.       }  
    27.       ENDCG  
    28.     }  
    29.     Fallback "Diffuse"  
    30. }