Hey,
I’m having issues with a simple shader that used to work fine.
I want to blend 2 colors / textures depending on the viewDir.
If I output it in the Albedo it does not work.
If I output it in the emission it works.
Works with new deferred.
Works with forward.
Problem occurs only with legacy Deferred
code:
Shader "Custom/RimBug"
{
Properties
{
_Color1("Color1", Color) = (1,1,1,1)
_Color2("Color2", Color) = (1,1,1,1)
_BlendPower("Blend", Range(0,10)) = 0.5
}
SubShader
{
Tags {"Queue" = "Geometry" "RenderType"="Opaque"}
CGPROGRAM
#pragma surface surf Lambert
#pragma target 3.0
fixed4 _Color1;
fixed4 _Color2;
float _BlendPower;
struct Input
{
float3 viewDir;
};
void surf(Input IN, inout SurfaceOutput o)
{
half rim = saturate(dot (Unity_SafeNormalize(IN.viewDir), o.Normal));
half mask = pow(rim,_BlendPower);
o.Albedo = lerp(_Color1,_Color2,mask);
}
ENDCG
}
Fallback "Diffuse"
}
Anyone has a clue on what’s going on?
Thanks!
