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

Guy guy at dvp.co.il
Wed Mar 18 23:21:06 PDT 2009


Hi Peter,
 I had something similar in my program. For me it happened when the
object where VERY FAR from the camera in the orthographic projection.
There were some distances that the objects disappeared and at even
greater distances it reappeared. 
 I think it have to be something with the computation of the near far
planes.

 I made a patch for this which work for me, at the same geometry that I
wanted to put in the problematic distance I added another primitive that
was as twice that distance. That primitive had zero alpha and I use
alpha blending. I need the alpha blending anyhow, but you could just put
very small primitive (point?) that you icon will hide anyway.

 What I don't get is if that's an orthographic projection, why does your
icons get smaller when you zoom out?

Hope it helps,
 Guy. 

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

It's not erratic, it's pretty strongly correlated to the projection 
matrix settings (determining the zoom level), camera distance and size 
of the icon.

I looked at the icon model, from inspecting the .osg file (converted 
from .ive with osgconv) it appears that the relevant state settings are:

          GL_CULL_FACE ON
          GL_LIGHTING ON
          GL_NORMALIZE ON
          Material {
            DataVariance STATIC
            ColorMode OFF
            ambientColor 1 0 0 1
            diffuseColor 1 0 0 1
            specularColor 0 0 0 1
            emissionColor 0 0 0 1
            shininess 0
          }
 From what I can tell from reading the OpenGL documentation and looking 
at the OSG code, this means it should ignore any per-vertex colors and 
just use the material settings, correct?  Does it still need a color
array?

The normals looks fine:
        NormalBinding PER_VERTEX
        NormalArray Vec3Array 6
        {
          0 0 1
          0 0 1
          0 0 1
          0 0 1
          0 0 1
          0 0 1
        }

The original .ive file was produced using OSGExp with 3D Studio Max 2008

(the plugin is still using OSG 1.2, though.)    I don't have much 
control over whether it outputs materials or per-vertex colors, unless I

go and noodle around with the nodes in code after loading them.  I 
suppose I could modify a file by hand to see if it makes a difference.

Another thing I noticed is that all the icons go black just before the 
camera zooms far enough that the icons are too small to render -- 
although in that case, it isn't very noticeable because the icons are 
already only a few pixels across on screen.

Also, I forgot to mention in my previous email but I'm using Open Scene 
Graph 2.6.1.

Thanks,
- Peter

Robert Osfield wrote:
> 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.
> _____________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
>
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g
>   

_______________________________________________
osg-users mailing list
osg-users at lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g



More information about the osg-users mailing list