|
Hiya all. I've modified the LayerShader from Unify so that it maps two textures (with alphas) to one mesh using two different UV maps. Is there any way I could modify it so that instead of combining MainTex with PathTex, it overlays MainTex over PathTex? The source is below:
Regards, Joel.
(comments are locked)
|
|
You should really check the docs on Texturing in ShaderLab. In the example there, they define a texture blend shader with
There are any number of kinds of functions you can use for combining textures and your use of terminology is unspecific.
Based on the fact that you have a "blend" property, it would seem you want to control using that property. I did something like that here.
or if you wanted it to be more of an additive combiner, you could do something like: Sorry, the blend property was left-over code from the LayerShader code and isn't relevant to what I want. I'll explain what I mean a bit better. Lets say my two textures are different transparent images with a series of random solid lines going through it. At the moment it draws the PathTex texture, and then draws the MainTex texture. If a line in MainTex overlaps a line in PathTex, it will combine the colours of the PathTex image and the MainTex image. How could I make it so that instead of doing this it draws the MainTex lines on top of PathTex lines without combining the colours? Thanks.
Nov 03 '10 at 08:18 PM
joeltebbett
That would be an alpha blend shader exactly as described above and given in the docs. Replace 'combine texture * previous, previous + texture' with 'combine texture lerp(texture) previous, previous + texture' in your shader and it should do what you describe.
Nov 03 '10 at 08:56 PM
skovacs1
That of course assumes that your "solid" areas have an alpha of 1. If they don't then that's something that you should have mentioned in the question and becomes much trickier.
Nov 03 '10 at 08:59 PM
skovacs1
You would get better results where they overlap and either of their alphas are not 1 if you didn't overwrite the alpha with previous + texture.
Nov 03 '10 at 09:02 PM
skovacs1
(comments are locked)
|
