#Something like z-depth for meshes

1 messages · Page 1 of 1 (latest)

supple yarrow
#

I want to render a mesh in front of another mesh even if it is in the back of it.

steep flint
#

Not sure what you mean by "z-depth for meshes", but you just need to disable z testing and render the mesh you want to be in front later than the other one.

supple yarrow
steep flint
# supple yarrow Can you explain? Also, I mean, I have 2 objects and I want to render the second ...

Normally, GPU renders one object at a time on top of what was already rendered. So if you just reverse the order, you'll be able to render it the way you want. Or so it would be if there was no depth check. The gpu first renders all the objects into a depth buffer and then when it renders the real thing it checks if a certain object pixel has higher depth than what's already in the depth buffer and avoids rendering it if it is.
So you need to fulfill 2 conditions in order to render objects in reverse like you want: disable depth check and make sure the object you want on top is rendered later.
The simplest way to achieve that would be to use transparent material/shader, as they don't render to depth. As for the ordering, you can increase the sorting priority(in the material) of the object you want to draw on top.