Drawing unobscured health bars in a Java 3D scene -


so i'm working on game in java 3d , i'm implementing health bars hover above units.

i started drawing quad @ 3d point above unit's location , applying billboard behavior make face camera.

but problem i'm stuck health bars obscured other scenery.

so i'm considering following options:

  1. overriding z / depth buffer value health bar pixels make renderer think they're closer camera renders afterwards.

    i tried renderingattributes.setdepthtestfunction(renderingattributes.always). while makes renderer draw health bar on top of drew in same area earlier, doesn't when other scenery drawn on top of health bar later.

    is there better way doing in java 3d?

  2. projecting 3d locations of health bars onto 2d plane in front of camera. sounds doable, before set off reinventing math required this, maybe can point out existing solution.

  3. switching java 3d lwjgl or jmonkeyengine (not issue, general complaints java 3d being dead, etc). although i'm not sure whether they're more flexible particular problem. , i've read, 1 of worst mistakes in game dev switching engine in mid-development.

use painter's algorithm: draw health bars after you've drawn rest of scene (and z testing turned off, of course).


Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -