[osg-users] LiSPSM and main camera nearFarRatio?

Wojciech Lewandowski lewandowski at ai.com.pl
Mon Sep 29 13:32:06 PDT 2008

Hi J-S,

I guess its related to my computation of clamped projection matrix. I need
to compute this matrix myself as its not yet computed when I cull shadows.
It is computed at the end of whole traversal. I copied clamping code from
osgSim::OverlayNode. I guess that for this computation I may somehow use
default clamp callback nearFarRatio. Put a breakpoint in line 255 in
MinimalShadowMap.cpp. This is the line where clampProjectionMatrix is called
and check what is the nearFarRation inside this call. Let me know what you
find. I think I did it right, so there is chance the error may be somewhere


-----Original Message-----
From: osg-users-bounces at lists.openscenegraph.org
[mailto:osg-users-bounces at lists.openscenegraph.org]On Behalf Of
Jean-Sebastien Guay
Sent: Monday, September 29, 2008 9:28 PM
To: OpenSceneGraph Users
Subject: [osg-users] LiSPSM and main camera nearFarRatio?

Hi all, Hi Wojtek,

I've been working on deploying the new LiSPSM in our simulators. While
fixing a totally unrelated problem today (when viewing from inside the
cockpit, the cockpit geometry was being clipped), I added some
parameters to control the nearFarRatio on a camera.

I have no idea why, but this seems to have an effect on shadows. More
specifically, the shadows are being clipped. The default nearFarRatio is
0.0005, and when I set it just a bit lower, 0.00049, the shadow of the
boom (arm) of our crane (when viewed from the cockpit) is clipped. The
more I decrease the nearFarRatio, the more the shadows are clipped.

I have looked a bit into the code, but since it's not my code, I may
have a hard time finding out what is causing this. Off the top of your
head, what might cause this? And what would you suggest to fix it
(meaning, be able to control the nearFarRatio of my main camera and
maintain correct shadows)?

For reference, I have set minLightMargin to 100, and maxFarPlane to 5000.

Thanks in advance,

Jean-Sebastien Guay    jean-sebastien.guay at cm-labs.com
osg-users mailing list
osg-users at lists.openscenegraph.org

More information about the osg-users mailing list