Game Development Reference
In-Depth Information
33 fixed4 main = c1.rgba * (1.0 - c2.a);
34 fixed4 blendedoutput = c2.rgba * c2.a;
35
36 o.Albedo = (main.rgb + blendedoutput.rgb) * _Color;
37 o.Alpha = main.a + blendedoutput.a;
38 }
39 ENDCG
40 }
41 Fallback "Transparent/VertexLit"
42 }
Once the shader is coded and saved, it appears as a selectable shader type for any
material you create via the Material panel in the Object Inspector. This shader
should be used for any object onto which details must be painted, as shown in the
following screenshot. The _MainTex slot refers to the background texture onto which
details must be overlaid but which must also be preserved from any true edits. The
_BlendTex slot refers to the texture to be overlaid onto _MainTex , which preserves
its alpha transparency. Typically, this slot will be populated at runtime from script
by generating an alpha transparent texture to receive brush strokes, as we'll soon see.
A custom shader is created to blend the top-most texture onto the bottom-most texture
 
Search WWH ::




Custom Search