[osg-users] distant nodes in orthographic projection turn black

Robert Osfield robert.osfield at gmail.com
Wed Mar 18 08:08:11 PDT 2009


Hi Peter,

Irratic changes of lighting + colour of objects in the scene as your move
the camera is typically due missing normals or colour arrays on the geometry
in the scene that is behaving oddly, as these missing arrays will mean that
their settings will be inherited from geometries that just happen to be
rendered before them.  Have a look at the problem geometry to see if that it
have any normal or colour arrays, and if they don't add them in.

Robert.

On Wed, Mar 18, 2009 at 2:41 PM, Peter Amstutz
<peter.amstutz at tseboston.com>wrote:

> I am having a puzzling problem that I hope someone might have some insight
> on what is happening:
>
> My application renders a terrain using a top-down, orthographic view, and
> places various icons (simple flat meshes mostly) to represent simulation
> agents (soldiers and vehicles).  One of our testers noticed that when you
> zoom out to a certain distance where the icons are very small but still
> visible, sometimes some of the units (always the medium and small icons)
> turn black.  Zooming in restores the proper color.  It is very sensitive to
> the projection parameters, sometimes it is correctly rendered at moderate
> zoom, turns black after zooming out, and then is colored properly again
> after zooming out even more.
>
> Some details:
> The icons are ordinary geode nodes.  They use flat color materials, no
> textures.  The icons are composed of several submeshes, usually text on a
> background with a border.  It's hard to say, but usually only one of the
> submeshes turns black.
>
> The camera is held at a fixed Z elevation, and "zooming" is accomplished by
> changing the orthographic projection parameters to have a wide view or a
> narrow view.  Panning on the XY axis changes only the XY camera position.
>
> The scene is lit with a single downward-facing infinite light.  It casts
> (.8, .8, .8) colored ambient light.
>
> I'm using the default setting for Near-Far culling plane.
>
> Icons are scaled based on a logarithm function of the zoom level (meaning
> that at high zoom levels the icons are scaled up a bit from their natural
> sizes, but not linearly with the zoom level).  I scale the icons by updating
> the transform matrix and calling dirtyBounds().
>
> This behavior is sensitive to the elevation of the camera.  When the camera
> was located at an elevation of 10000 units (meters) many of the icons would
> exhibit this problem, when the camera was lowered to 1000 units, fewer icons
> rendered improperly, and at 300 units everything rendered just fine.
>
> So, tentatively the solution is simply to ensure that the camera is placed
> as close to the action as possible, but if anyone has any ideas as to what
> is really going on here, I would be very curious.  Perhaps I am running
> afoul of some "small object" optimization, that culls objects thought to be
> too small to show up on screen?
>
> - Peter
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20090318/b683cb5f/attachment-0003.htm>


More information about the osg-users mailing list