Transparrent PNG over reflective shader

Sorry if this is the wrong forum to post this on. I didn’t put it under shader lab because I thought that may be dedicated to writing Unity shaders.

Ok what I have is a car with a reflective/diffuse shader. I then add a dull cubemap to give it that reflective look. So what I want to do is add decals to the car. The decal is a transparrent PNG that fit the car because of the UVW I built in 3d studio.

I tried transparrent/Cutout/Diffuse but no matter what shader I tried over the reflective shader I get a lot of Z-fighting on the texture.

I tried placing the reflective shader as element 0 and the cutout on element 1 and the other way around. I just can’t get rid of the Z-fighting. I then tried different shaders other then cutout/diffuse, but I had the same z-fighting with each one.

As a side note I made my reflective/diffuse shader just Diffuse and the png looked fine, but I then lost the reflective cubemap.

Any ideas?

If you are using the same geometry for car and decals, you’d want to render both with the same shader. You need to make a custom shader which combines the textures (use multiple SetTexture calls), or multiple passes.

THanks I thought I would need to create a custom shader.

If I where to use 2 models one with the cutout shader and one with the reflective shader. Do you think that will decrease performance? Like would it be faster to use a customer shader or 2 models?

um, 10000x faster using a customer shader. Why would you render 2 lots of geometry instead? Even forgetting about probable z-buffering issues, its a dramatic extra overhead.

Look over the current shaders and you will quickly find/learn enough to be able to copy and paste some shader code around and tweak to get an extra texture layer in there working as a decal.