I’ve been playing around with a shader I found in the forums:
(The one at the bottom of this post)
struct SurfaceOutputHatch {
fixed3 Albedo;
fixed3 Normal;
fixed4 Hatch;
fixed3 Emission;
fixed Specular;
fixed Gloss;
float Alpha;
};
void surf (Input IN, inout SurfaceOutputHatch o)
{
o.Albedo = tex2D (_MainTex, IN.uv_MainTex).rgb;
o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_MainTex));
fixed2 specGloss = tex2D(_SpecularTex, IN.uv_MainTex).rg;
o.Specular = specGloss.r * _ShinPower;
o.Gloss = specGloss.g * _GlossPower;
o.Hatch.r = tex2D(_Hatch0, IN.uv_Hatch0);
o.Hatch.g = tex2D(_Hatch1, IN.uv_Hatch0);
o.Hatch.b = tex2D(_Hatch2, IN.uv_Hatch0);
o.Hatch.a = tex2D(_Hatch3, IN.uv_Hatch0);
}
and it adds a “fixed4 Hatch;” to the custom SurfaceOutputHatch struct and then in the surf function it assigns values to the separate channels in o.Hatch… but then when you run it, it adjusts the shadows to follow the pattern supplied in the textures.
Can anyone explain to me, or point me to some documentation as to what it is doing with these extra 4 layers of information after it leaves the surf shader? I can’t figure out why it works. It works fine, I just don’t know why.
Why wouldn’t the o.Hatch be added as a red green blue and alpha’d smear?