Instead of seeing the things behind the object, I am simply seeing the scene's clear colour. This line of code worked as expected in a previous project with Ogre so I'm a little confused.
Ogre uses the AABB size and distance to camera to determine which object is in front of which; as transparents must be drawn back to front for correct alpha blending.
However when one big object acts as "the room" like in your example, these approximations can easily break; because it think the room is closer to the camera and should be rendered last (and that's wrong, it should be rendered first).
The solution is to place the big object enclosing everything into a lower render queue; so that you're controlling the order manually. ie. for "the room" call setRenderQueueGroup( 0 ); and for the rest of the items call setRenderQueueGroup( 2 ); (we skip 1 because that's where usually v1 Entity go by default, but you can use 1 if you have no v1 entities)
Make sure you call sceneManager->getRenderQueue()->setRenderQueueMode( 2, RenderQueue::FAST ); before doing any of this, to set render queue group #2 to accept v2 objects.
dark_sylinc wrote: ↑Sun Mar 03, 2019 11:56 pm
Ahhhh. Now it makes sense.
Ogre uses the AABB size and distance to camera to determine which object is in front of which; as transparents must be drawn back to front for correct alpha blending.
However when one big object acts as "the room" like in your example, these approximations can easily break; because it think the room is closer to the camera and should be rendered last (and that's wrong, it should be rendered first).
The solution is to place the big object enclosing everything into a lower render queue; so that you're controlling the order manually. ie. for "the room" call setRenderQueueGroup( 0 ); and for the rest of the items call setRenderQueueGroup( 2 ); (we skip 1 because that's where usually v1 Entity go by default, but you can use 1 if you have no v1 entities)
Make sure you call sceneManager->getRenderQueue()->setRenderQueueMode( 2, RenderQueue::FAST ); before doing any of this, to set render queue group #2 to accept v2 objects.
Cheers
Matias
The smaller cubes shown in my example aren’t actually inside of the bigger object, so it isn’t really acting as a room.
The big cube is definetly behind the smaller objects, with no intersection and room to spare, so why does Ogre struggle to determine what’s in front of what?
Thanks for your solution though, it worked but I’m not sure if it’s gonna be fine for multiple “big” objects that have transparency?
Roughly speaking, for a certain Ogre::Item, Ogre approximately uses its vertex position that is nearest to the camera - to do dept sort.
Ogre doesn't use the center of Ogre::Item to sort. This can cause glitch in some scenes (including my scene).
Are you sure that such vertex of the big cube is far from camera more than such point of a smaller one?
Depth bias may help, but I have never tried it.