Here is the shader in as bare-bones a way as I can get it.
The problem is as follows. It seems that when I use both a texCUBE lookup and try to assign a value to o.Normal, the shader completely fails and just falls through to the Fallback call. I can use either one on it’s own and the shader behaves as expected but as soon as I try to use both then it’s blowing up in my face.
Any advice?
Shader "Custom/UnknownFailure" {
Properties {
_MainTex ("Main Texture", 2D) = "white" {}
_BumpMap ("Normal Map", 2D) = "bump" {}
_CubeMap ("Static Cubemap", Cube) = "" {}
}
SubShader {
Tags { "RenderType"="Opaque" }
CGPROGRAM
#pragma target 4.0
#pragma surface surf BlinnPhong
sampler2D _BumpMap;
sampler2D _MainTex;
samplerCUBE _CubeMap;
struct Input {
float2 uv_MainTex;
float3 worldNormal;
};
void surf (Input IN, inout SurfaceOutput o)
{
half4 finalColor = tex2D(_MainTex, IN.uv_MainTex);
//Problem Lines. One or the other can be active, but not both
finalColor = texCUBE(_CubeMap, normalize(IN.worldNormal));
//o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_MainTex));
o.Albedo = finalColor.rgb;
}
ENDCG
}
FallBack Off
}