- Home /
How to blend 2 quads in the same location
Hi all,
I know this has probably been answered before so please point me to the right post if so.
I need to blend 2 quads together. One should fade in on top of the other when I call a script function.
The quads are instantiated in a script. I was thinking that one quad could be completely transparent, and then fade in after the function call.
Is that the way to go or is there a better way?
Answer by Eudaimonium · May 27, 2016 at 10:50 AM
Could you describe more what are you trying to achieve, what is your final result?
Normally having two surfaces overlap is a very bad idea (Z-fighting artifacts).
Instead I would recommend using only one plane, but a specially written shader that will blend the two textures you need in a crossfade manner. I can write such a shader for you if you describe what sort of textures you're blending (what effect are you trying to get).
Thanks, I'm trying to overlay a mostly transparent texture on a base image. In the screenshot, the $$anonymous$$RI is the base and the red dotted lines are in the overlay.
Using your advice, I found some example code: ![Properties {
_Blend ("Blend", Range (0,1)) = 0.5
_$$anonymous$$ainTex ("Base (RGB)", 2D) = "white" {}
_BlendTex ("Alpha Blended (RGBA) ", 2D) = "white" {}
}
SubShader {
Pass {
// Apply base texture
SetTexture [_$$anonymous$$ainTex] {
combine texture
}
// Blend in the alpha texture using the lerp operator
SetTexture [_BlendTex] {
combine texture lerp (texture) previous,
}
}
}][1]
[1]: /storage/temp/70892-screen-shot-2016-05-27-at-102905-am.png
I would like to use the "_Blend" property to fade in the red lines somehow. I've tried a few things but they all affect the background $$anonymous$$RI, which I want to remain constant.
Thanks for the help
Your answer
![](https://koobas.hobune.stream/wayback/20220612081642im_/https://answers.unity.com/themes/thub/images/avi.jpg)