I'm trying to write a shader that overlays two textures (with transparency) and can't figure out how to do the overlay. I'm aiming for a neon look so want to have the glow texture rendered first (colored with the vertext color) and then the white (light) texture rendered on top of that. I want one texture overlaid on the other. I have this: fixed4 col = (tex2D(_NeonColorTex, i.texcoord) * i.color + tex2D(_NeonLightTex, i.texcoord))/2; which would average them out, so clearly not what I want. I googled this but only found lerp approaches, which wouldn't work for me. How do I overlay the two colors? I'm guessing some multiplication with the alpha somehow?
Ok, this seems to be working for me: fixed4 frag_mult(v2f_vct i) : COLOR { fixed4 coloredGlow = tex2D(_NeonColorTex, i.texcoord) * i.color; fixed4 whiteOverlay = tex2D(_NeonLightTex, i.texcoord); fixed4 cNew = coloredGlow + (whiteOverlay.a * whiteOverlay); cNew.a = max(coloredGlow.a, whiteOverlay.a); return cNew; }