On 11 April 2012 15:35, Daniel Schmid <[email protected]> wrote:

>  Hi all****
>
> ** **
>
> Somehow I feel pretty alone out here working with VDSM… ** **
>
> I have a huge paged terrain, and shadow looks awesome unless that as soon
> as I change my viewpoint (move camera), the shadows start to flicker and
> fuzz. I need somehow to limit the shadow distance… similar to
> MinimalShadowMap where you can set min max clip plane. I tried to modify
> computeShadowCameraSettings method by setting the xyzMinMax values fort he
> projectionMatrix to fix values, but this didn’t bring much success.****
>
> ** **
>
> Does anybody have a modified or advanced version of VDSM with a clipping
> limit ?****
>
> ** **
>
> Regards****
>
> Daniel****
>
> ** **
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
Hi Daniel

I replied to you on the forum last week but I see my post never got through.

I have done this, although I don't have a copy against the current VDSM
source. I haven't tested this code, but it was working for me when I used
it, so what you want to do is certainly possible. What I did was to
override the VDSM::cull method and then after the first scenegraph
traversal I had code like this:

// 1. Traverse main scene graph
cv.pushStateSet( _shadowRecievingPlaceholderStateSet.get() );

osg::ref_ptr<osgUtil::StateGraph> decoratorStateGraph =
cv.getCurrentStateGraph();

cullShadowReceivingScene(&cv);

cv.popStateSet();

if (cv.getComputeNearFarMode()!=osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR)
{
    OSG_INFO<<"Just done main subgraph traversak"<<std::endl;
    // make sure that the near plane is computed correctly so that any
projection matrix computations are all done correctly.
    cv.computeNearPlane();
}

maxZFar=osg::minimum( maxZFar , (double)_maxFarDistance ); // <<-- The
change
Frustum frustum(&cv, minZNear, maxZFar);


Where _maxFarDistance was my cutoff value.

I'm currently playing with Wang Rui's updates which look good - at least
the PSSM implementation works well, but VSM is failing for me atm. We still
have major clipping problems with directional lights so are using
positional instead.

best wishes
Mike
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to