Overlay depth

Started by Alexey, September 30, 2011, 01:24:27 PM

Previous topic - Next topic

Alexey

Hello, i have an overlay issue - when camera overlaps with some object, overlay overlaps too (depth set to 0). For example:

Can i in some way avoid overlapping objects with overlay?

K24A3

Try setting the depth of the overlay to something like -100 when calling Overlay.setDepth().

However if you are changing the World render depth using World.setClippingPlanes(), the overlay depth seems inconsistent, causing overlays to render behind 3D objects. Not sure if it's a bug or not, perhaps Egon can provide some insight.

Alexey

Quote from: K24A3 on September 30, 2011, 06:53:33 PM
Try setting the depth of the overlay to something like -100 when calling Overlay.setDepth().
I can't say which version of javadoc i has read, but i remember that depth mast have positive value

EgonOlsen

Try something like Config.nearPlane+0.xf instead of 0. 0 makes no sense and will be silently adjusted to Config.nearPlane+1. However, you may still run into this kind of problem, because an Overlay is actually an Object3D and as such, it interacts with the rest of the scene. If you don't want this, you have two options: Use blitting instead or put all Overlays into a separate World-instance, which will be rendered after the main world. Remember to clear the zbuffer between the renderings.