Author Topic: Overlay depth  (Read 3477 times)

Offline Alexey

  • int
  • **
  • Posts: 50
    • View Profile
Overlay depth
« on: September 30, 2011, 01:24:27 pm »
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?

Offline K24A3

  • long
  • ***
  • Posts: 231
    • View Profile
Re: Overlay depth
« Reply #1 on: September 30, 2011, 06:53:33 pm »
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.

Offline Alexey

  • int
  • **
  • Posts: 50
    • View Profile
Re: Overlay depth
« Reply #2 on: September 30, 2011, 09:00:34 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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Overlay depth
« Reply #3 on: September 30, 2011, 09:22:11 pm »
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.