Hi Kamil,

Vertex processing in OpenGL graphics hardware is all float precision
so you have to be careful how you manage data with large values,
texgen is no different.  The best way to deal with this issue is to
make sure all you geometries all have a local origin and then use a
transform to place it in its final location.

The OSG by default uses double matrices for both the camera's view
matrix and the the transforms in the scene.  The OSG will accumulate
all these matrices as doubles and then pass to OpenGL and the driver
will drop the precision back to float, precision has been kept as long
as possible, and the accumulation of matrices tends to help minimize
the final translations and therefore the final data sizes.  Do this
and you'll have the best chance of texgen working well too.

Robert.

On 6/8/07, Kamil Krupa <[EMAIL PROTECTED]> wrote:
Hi Everyone,

I have a graphics scene with large terrain (width more than 1 000 000
meters). The scene graph looks like this:

             camera
               |
    ---------------------------
    |       |       |         |
   MT0     MT1     MT2  ...  MTn
    |       |       |         |
  GEOM1   GEOM2   GEOM3     GEOMn

Matrix transforms MT0..MTn provide positioning geometries GEOM1..GEOMn
with small values in respect of number presicion in graphics hardware
(float - mantisa max 24b)

I placed small geometry(bouding box diameter 5 meters) into this scene
at large position (600000, 600000, 100). For positioning I used also
MatrixTransorm.

Then I set up scene to use projective shadow mapping. A camera from
light (positioned at large z coord) make shadow texture. Viewing frustum
of this camera is adjusted to view objects near in front of observer
camera. To projective mapping I adjust TexGen from Light transform
(modelview and projection) as show example 'osgshadowtexture'.

When I run my application and I setup camera to look at shadow, the
shadow is jerking. Every objects in the scene (terrain and shadowed
object) looks good (not jerking).

I assume that reason of this error is at calculation of texture
coordinates (s, t, u, v) with float precision. In this context for every
coordinate is evaluated linear equation ax + by + cz + dw = 0, where I
assume that a, b, c, d is large values and x, y, z, w is large values too.

I tried to test this problem by modifying example 'osgshadowtexture'. I
put Shadowed and Shadower beneath MatrixTransforms with large x
coordinate and this error occured again.

I enclosed modified osgshadowtexture example.

Has anybody any idea to solve this problem?

Kamil Krupa



_______________________________________________
osg-users mailing list
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/


_______________________________________________
osg-users mailing list
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to