I have a single mesh composed of two or more overlapping planes. When I add transparency to the mesh the overlapping area are added together (image on the left) which is what I’m trying to avoid. The final result im trying to achieve is that the transparency will effect the mesh as a whole and the whole object with have a unified transparency(image on the left). Any ideas on how this can be done?
You can try using BlendOp Max or Min not sure how it will work with other object blended with it
Ill look into that. I guess I should mention that the planes on the mesh are textured, and the textures can be composed of various colors and transparencies. Rgba32 typically.
Can you use worldspace UV ? You might have some z-fighting but it might help blend them.
You may take Unity’s transparent shader and create a variant of it that writes to the z buffer. Like that only one of them is going to be drawn.
I think creating a z-buffer shader might be what I’m looking for. I’m new to shaders, especially in unity, so sorry if my shader vocabulary might be off. Google’ing “unity z-buffer shader” brought up this article which seems to be what im looking for.
There’s an image in there that shows a robot that has the issue I’m describing.
What should i google’ing to figure out the process to create a shader that would achieve what im looking for?
The problem occurs when you have more than one mesh though, if you want any kind of soft edge, such leaves overlapping the unfortunate side effect is this additive effect, and if you zwrite then you get the hard egdes of the mesh as well. What you can do tho, it use an alpha cut out shader with a stencil buffer then add in soft egdes, this should minimise the effect whilst giving you something you might desire.
Thanks Stencil buffer is not something i knew about or considered. it looks promising. Is it a heavy operation?
Not really no, obviously has a cost to it, like anything, but it’s barely noticeable on mobile devices across a fair few meshes, so I presume it’s fine to use quite extensively.