- Home /
Is it possible to z-order triangles with transparency?
First question for me guys. I'll try to be a clear as possible.
This is a fairly classic z-ordering question. I've scanned through a few answers and read as much as I can about how z-ordering works but still I'm not sure if there is a practical solution to this problem.
In the screenshots presented below, all of the objects in the scene are part of one single object. This object has lots of blocks (think voxels) with RGBA png textures. As you can see, alpha is transparency, and the screenshots are taken using Unity's transparent vertex lit shader.
The first picture is taken looking through the dice from front to back. The second picture is taken looking from back to front. You can therefore see the draw order of the triangles clearly determines if things are drawn correctly.
I tried downloading the shader and using it with ZWrite On. This make objects that are drawn look correct, but not all objects behind an object are drawn. I believe this is part of the purpose of using the zbuffer in the first place?
Using a cutout shader as others have suggested works just fine, but I'm still looking for semi-transparency.
The question is, is there any way to achieve the following?
Semi Transparency.
Correct Z-Ordering within a single object.
Correct Z-Ordering between multiple objects.
Thanks.
The green die is on the upper-right side of the red-die in both pictures, yet the second picture is taken at 180 degrees, around the red die, from the other? That doesn't work in my brain, I must misunderstand. FYI: $$anonymous$$y transparent objects all seem to z-order properly, without any extra work. (even my INSIDE faces) Are you trying to do something special?
Hi Glurth. The images are on a procedural meshe with many cube shapes. The inside faces of the cubes are not rendering. I'm using Transparent VertexLit shaders for this image. Therefore, you're always seeing the side of the cube face you, in both pictures.
Oh, those 3 dice are just a texture- I thought they were actual 3d objects themselves. That also explains why they are so flat in places!
Answer by Owen-Reynolds · Jan 17, 2015 at 11:13 PM
I think if you set the correct renderQueu(?) (transparent?) Unity automatically zOrders for you.
And then, I'm pretty sure having a single model handle transparency within itself correctly -- that's well-known to be a mess requiring specific hacks to avoid (like chopping it into parts, or avoiding the bad angles.)
That's what I feared. I'll leave this question open for a little longer in case anyone has any particular pearls of wisdom before I accept an answer.
Your answer
Follow this Question
Related Questions
can see inside object that is supposed to be fully opaque 0 Answers
Transparent shader decreases frame rate. Which material i should use for transparent object? 3 Answers
Rendering object that is partially obscured by another 1 Answer
Semi-Transparency, Sprites, and Sorting Groups [Unity 3D] 1 Answer
HDRP Lit Shader: How to disable Transparency "Blend preserve" through script? 0 Answers