On Wed, 2011-09-28 at 11:37 -0600, Paul Martz wrote: > On 9/28/2011 9:22 AM, Jean-Sébastien Guay wrote: > > Hi Jeremy, > > > >> My question is how do I render these objects? Should I treat them > >> specially (for example, adding them in a post render camera) or should I > >> simply position them properly to be rendered in the main frame? I'm > >> looking for some "gotchas" from other people who have done something > >> similar. > > > > I'd render them as a separate camera, simply because they're very close to > > the > > eye and so might affect your depth range and precision pretty drastically. > > If > > you render them as a separate camera, you'll then have a main camera with a > > z > > range starting at over 1m (probably the ground will be the closest object > > most > > of the time) and a post-render camera with a very small near distance but a > > very close far distance too, so that's ideal. You can even keep automatic > > near-far calculation on for both, and it will likely work really well. > > I agree with J-S. If you use ABSOLUTE_RF and an identity view matrix, you > should > be able to draw these scene elements directly in eye space (you're looking > down > the -z axis with +y up). In OSG parlance, it's effectively a "HUD". > > In OpenGL, the pattern looks like: push the modelview matrix, set it to > identity, draw, then pop. Whenever rendering calls for this OpenGL pattern, > in > OSG you should immediately think "Camera". > -Paul
Rendering directly into the framebuffer from a 2nd camera (like a HUD, as you said) turned out to really simplify things, but it does--of course--change how I need to handle lighting. Since the gun never technically moves (though it appears to because of the first camera) I'll have to come up with a way of updating this second camera with the proper lighting variables... > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org