Hey there,
After couple hours of research and testing, I found the perfect Surface Shader traduction of my old 1.1 Lightmap Shader.
Before, when I used traditional passes, it would be written :
SetTexture [_Selfillum] {
combine texture + primary
}
SetTexture [_MainTex] {
combine texture * previous , texture
}
where _MainTex is your main texture, and _SelfIllum your custom black white lightmap. The more white a zone is, the more self-lit it is, without burning the color or overshooting its lighting (those were the 2 reasons why I didn’t use Emission parameter instead).
So now that Surface Shaders are in, here is how it would be perfectly traduced.
Everything necessary is contained in the surf function :
void surf (Input IN, inout SurfaceOutput o) {
half4 _lightmap = tex2D (_Selfillum, IN.uv_MainTex);
half4 tex = tex2D(_MainTex, IN.uv_MainTex);
o.Albedo = tex.rgb*(1-_lightmap.rgb);
o.Emission = tex.rgb*_lightmap.rgb;
o.Alpha = tex.a;
}
It’s basically masking the Albedo zones with the Lightmap, as the Emission channel is added over it.
Hope it helps !
edit : I forgot to mention that this Surface Shader should not interfere with Beast lightmaps.