Shaders confuse me. I got things working in several layers of materials, but in the end I think it can be in one material and not the multiple materials is giving me problems under the new iPhone build.
I want a diffuse shader that
I can set a LETTER (a black letter PNG on a clear background)
ForegroundColor (the color I want the black letter to be
BackgroundColor
And If I set the LETTER to an image of an A, and the Foreground color as White and the background color as Blue, it would have a White ‘A’ against a blue background. Shouldn’t be too difficult, should it?
The script works, but I’m looking for fragment instead of vertex shader as it’s important that the vertex shading “artifacts” are not visible.
Sorry I should have been more clear.
I’ve created a globe using Unity’s built-in shader Specular Bump. I like to be able to assign the Sea Land colors seperately using a script with the help of an alpha matte. Currently the build-in shader only allows me to use a color texture ( with alpha ) to color the globe.
I’ve downloaded the Built-in shader and tried to incorporate the above scripts, but I’m really weak with shaders. Any help appreciated.
You should be able to make that shader do what you want. You’ll have to modify the fragment shader (beginning with float4 frag…) and have it use the alpha channel of the main texture to generate the colour. The only variables you’ll need to add are the sea and land colours. In addition to adding them to the material block, you’ll need to add them to the Cg block, just like _Shininess has been added. This makes them available for use in the fragment program.
The Cg block of the shader is the part that begins with CGPROGRAM and ends with ENDCG. It looks like C, which Shaderlab otherwise doesn’t. You should read the first five chapters of the Cg Tutorial to get started with Cg.