- Home /
Multiple Transparent Materials Merging
Hi,
I have a cube which I'm putting multiple materials on, using the materials array. However, both the materials are using the Transparent/Cutout/Diffuse shader, which for some reason is making them blend into eachother. It's making the bottom material show through the top material.
I used black for the transparency colour so I find it strange that the 'cutout' would suddenly become partially transparent as well.
It only happens when both materials are transparent, when the bottom material is regular diffuse, the 'cutout' material overlays as it should. I'm not sure how to stop this happening.
Screenshot would help. But it sounds like you're just having sorting issues. I don't know what you mean by "I used black for the transparency colour".
http://tinypic.com/r/5uofg0/7 This is what happens, the two materials merge together. http://tinypic.com/r/2nkuf7o/7 This is what happens when I change the material colour to black. That is what I want to happen but not by changing the material colour to black. I've been doing some messing around with material.renderQueue, if I add a material to the materials array and then reverse it so that the newly added material becomes element 0 and vice versa, then set renderQueue to 1(element1) and 2(element0) it works? Unfortunately does not work for more than two materials in the materials array, tho
Answer by Liens · Mar 31, 2011 at 11:27 PM
I fixed the problem by adding the material to the gameObject.renderer.materials array (Using Unshift()), then setting gameObject.renderer.material.renderQueue to 1. For every material I added to the gameOject.renderer.materials array, I set the renderQueue of the added material to array.Length+1
So now they all overlap in order.
Your answer
Follow this Question
Related Questions
Transparent shader decreases frame rate. Which material i should use for transparent object? 3 Answers
Certain faces appearing transparent, both before and after applying materials 0 Answers
Multiple textures on single object similar to terrain painter? 2 Answers
How do I properly apply a transparent texture to a mesh? 2 Answers