OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

osgShadow LiSPSM culling problem


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> Plugins [osgPlugins]
View previous topic :: View next topic  
Author Message
gcope
User


Joined: 18 Feb 2010
Posts: 45

PostPosted: Fri Aug 17, 2012 12:30 pm    Post subject:
osgShadow LiSPSM culling problem
Reply with quote

Hi,

I'm working with the osgShadow LiSPSM implementation as that seems to be the one that people have had the most success with. The shadows are great, but are being clipped vertically as the shadowing object moves near the left or right edge of the window.

I've seen similar issues in other threads, but have tried the following previously suggested solutions with no result:

- Using one directional light angled at the geometry
- Tried various values for minLightMargin
- Set distant MaxFarPlane

If I comment out the clipping function in MinimalShadowMap everything works as expected, but of course I need to clip the shadows for it to be feasible.

The problem seems to be with the calculation of the CullVisitor's projection matrix used for clipping, but I have yet to find out where this is being calculated so I can see what the problem might be. I'm hoping Wojtek or someone more familiar with this plugin can point me in the right direction.
...

Thank you!

Cheers,
Garrett
Back to top
View user's profile Send private message
Wojtek
User


Joined: 02 Nov 2011
Posts: 91

PostPosted: Fri Aug 17, 2012 7:30 pm    Post subject:
osgShadow LiSPSM culling problem
Reply with quote

Hi Garret,

I have not worked on Lispsm for long time but description of your problem may suggest that my method of obtaining main camera and its projection matrix may not work as it used to or your setup uses unusual multi channel master / slave configuration that was not tested so far. I am obtaining main view camera in several places in the code using this construct:


_cv->getRenderStage()->getCamera()


you may check if its still returning the right camera by adding asserts checking its projection matrix (getProjectionMatrixAsFrustum and check if near/far/left/right/top/bottom values are correct). 


One of the older problems with main camera was use of COMPUTE_NEAR_FAR flag. You may try turning it off and see if it affects your results.


If above does not help, I will ask you to create simple applet to show your problem and I may try to debug it in spare time.


Cheers,
Wojtek Lewandowski









2012/8/17 Garrett Cope < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)>
Quote:
Hi,

I'm working with the osgShadow LiSPSM implementation as that seems to be the one that people have had the most success with. The shadows are great, but are being clipped vertically as the shadowing object moves near the left or right edge of the window.

I've seen similar issues in other threads, but have tried the following previously suggested solutions with no result:

- Using one directional light angled at the geometry
- Tried various values for minLightMargin
- Set distant MaxFarPlane

If I comment out the clipping function in MinimalShadowMap everything works as expected, but of course I need to clip the shadows for it to be feasible.

The problem seems to be with the calculation of the CullVisitor's projection matrix used for clipping, but I have yet to find out where this is being calculated so I can see what the problem might be. I'm hoping Wojtek or someone more familiar with this plugin can point me in the right direction.
...

Thank you!

Cheers,
Garrett

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=49305#49305





_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
gcope
User


Joined: 18 Feb 2010
Posts: 45

PostPosted: Mon Aug 20, 2012 6:10 pm    Post subject:
osgShadow LiSPSM culling problem
Reply with quote

Hi Wojtek,

Thanks for replying.

The projection matrix at the points you mention matches what it is in my main app. I also set do_not_compute for the near/far planes on the main camera but didn't find any difference.

If I understand the clipping correctly, it's just a polytope representing the bounds of the shadow cut by a unit bounding box transformed by the main camera projection matrix. This means that either the shadow bounds calculation is wrong or my fundamental projection matrix is wrong... Does this sound right?

I will try to come up with a simpler example to see which is the culprit.

Thanks again for your help.

...

Thank you!

Cheers,
Garrett
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12261

PostPosted: Thu Aug 23, 2012 11:08 am    Post subject:
osgShadow LiSPSM culling problem
Reply with quote

Hi Garret,

Could I suggest that you try out the new
osgShadow::ViewDependentShadowMap found in svn/trunk of the OSG, it's
more robust and flexible than the old LispSM implementation.

Robert.


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
gcope
User


Joined: 18 Feb 2010
Posts: 45

PostPosted: Thu Aug 23, 2012 5:18 pm    Post subject:
osgShadow LiSPSM culling problem
Reply with quote

Hi Robert,

Thanks for the suggestion! VDSM is nice and concise - nice work!

But unfortunately I still get the same clipping problem with it, so I'm sure it's something wrong on my end. I'll keep plugging away and see what I can come up with.

Thanks again,
Garrett
...
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12261

PostPosted: Thu Aug 23, 2012 6:10 pm    Post subject:
osgShadow LiSPSM culling problem
Reply with quote

Hi Garret,

On 23 August 2012 18:18, Garrett Cope <> wrote:
Quote:
Thanks for the suggestion! VDSM is nice and concise - nice work!

But unfortunately I still get the same clipping problem with it, so I'm sure it's something wrong on my end. I'll keep plugging away and see what I can come up with.

You'll need to post screen shots so can get an idea of what is
happening at your end. If it's possible to recreate using the
osgshadow example then it'd be really useful.

Robert.


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
gcope
User


Joined: 18 Feb 2010
Posts: 45

PostPosted: Thu Aug 23, 2012 6:28 pm    Post subject:
osgShadow LiSPSM culling problem
Reply with quote

Robert,

Attached are two screen shots. 'shadow_before' is the base state with a box casting a perfectly fine shadow. 'shadow_after' is where I have rotated the camera such that the box has moved out of view to the right. In this image you can see another clipping edge beginning at the bottom of the shadow that moves relatively vertically as the box continues to rotate to the right of the viewing window.

As with the LiSPSM implementation, if I comment out the clipping section (here in adjustPerspectiveShadowMapCameraSettings(..) function), it looks fine but of course is then not clipped at all.

Thanks again,
Garrett
... [/img]
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12261

PostPosted: Fri Aug 24, 2012 10:58 am    Post subject:
osgShadow LiSPSM culling problem
Reply with quote

Hi Garret,

On 23 August 2012 19:28, Garrett Cope <> wrote:
Quote:
Attached are two screen shots. 'shadow_before' is the base state with a box casting a perfectly fine shadow. 'shadow_after' is where I have rotated the camera such that the box has moved out of view to the right. In this image you can see another clipping edge beginning at the bottom of the shadow that moves relatively vertically as the box continues to rotate to the right of the viewing window.

Thanks for the screenshots, unfortunately it doesn't quite provide
enough clues to know what might be amiss.

Could you output a small model that using the osgshadow example can be
used to recreate the issue?

You can record a camera path with osgshadow by pressing 'z' to start
and 'Z' to finish, this then writes out a file saved_animation.path,
you can then replay this in osgviewer/osgshadow using the command line
option -p saved_animation.path.

Quote:
As with the LiSPSM implementation, if I comment out the clipping section (here in adjustPerspectiveShadowMapCameraSettings(..) function), it looks fine but of course is then not clipped at all.

It sounds like the light space extents isn't being fitted properly, or
there is an error in the adjustment of the shadow map projection
matrix for the light space extents. Debugging these issues requires
models that can recreate the issue though, there isn't really anything
I can do without being able to reproduce the problem.

Robert.


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
gcope
User


Joined: 18 Feb 2010
Posts: 45

PostPosted: Fri Aug 24, 2012 1:38 pm    Post subject:
osgShadow LiSPSM culling problem
Reply with quote

Hi Robert,

I haven't been able to reproduce my specific problem with the osgshadow example, but I have been able to reproduce all kinds of weird clipping planes. Just none that are resolved by commenting out the aforementioned section.

For instance, if I set the default light direction in the example to pretty much anything other than 0,0,1 (for instance: 0,-1,1) and then rotate the model around with the manipulator, the shadows get clipped along strange lines.

I will keep trying to reproduce my specific instance of the issue.

Thanks again for the help,
Garrett
Back to top
View user's profile Send private message
gcope
User


Joined: 18 Feb 2010
Posts: 45

PostPosted: Fri Jan 18, 2013 3:25 pm    Post subject:
osgShadow LiSPSM culling problem
Reply with quote

Hi Robert,

This is a super-delayed follow-up but I've finally circled back around to this issue.

Using the standard osgshadow example I can reproduce the general problem I'm having (shadows being clipped prior to the edge of the screen) by running with the following parameters:

osgshadow --directionalLight --light-dir 0.969358 -0.218775 -0.111722 --noUpdate --vdsm -3

Then if you hit '3' to change navigation mode and move the mouse right such that the models move towards the left edge of the screen, you will see that near the edge shadows on the sphere get clipped out entirely.

This is the behavior that I am seeing in many other instances in my own testing and have narrowed it down to the clipping but not made it much farther than that.

Any insight you have would be greatly appreciated.

...

Thank you!

Cheers,
Garrett
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12261

PostPosted: Fri Jan 18, 2013 3:37 pm    Post subject:
osgShadow LiSPSM culling problem
Reply with quote

Hi Garret,

I used your suggestion command line options but haven't spotted the
clipping issue yet. I'm using svn/trunk version of the OSG. Which
version are you using?

Could you record an animation path by pressing 'z' to start and again
'z' to stop and save to a saved_animation.path file. This file can be
passed to osgshadow on the command line by adding -p
saved_animation.path. Using this method it's possible to reproduce
exactly the same camera angles, and can be attached to an email so
that others can reproduce exactly what you are testing.

Thanks,
Robert.

On 18 January 2013 15:25, Garrett Cope
<> wrote:
Quote:
osgshadow --directionalLight --light-dir 0.969358 -0.218775 -0.111722 --noUpdate --vdsm -3


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
gcope
User


Joined: 18 Feb 2010
Posts: 45

PostPosted: Fri Jan 18, 2013 3:51 pm    Post subject:
osgShadow LiSPSM culling problem
Reply with quote

Hi Robert,

Thanks for the quick reply.

I am using 3.1.1 with the hopes of remaining somewhat stable. Wink
Perhaps I should try the svn/trunk version.

Attached is the animation path that shows the clipping on my installation. The forum would not allow the *.path extension so I change it to .txt

Thanks again.

Cheers,
Garrett
Back to top
View user's profile Send private message
gcope
User


Joined: 18 Feb 2010
Posts: 45

PostPosted: Fri Jan 25, 2013 5:51 pm    Post subject:
osgShadow VDSM culling problem
Reply with quote

Hi Robert,

I checked the svn/trunk last week and as you said the clipping problem seems to have been resolved.

After exploring your new VDSM implementation further, it seems that there is a bug with the ReceivesShadowTraversalMask (or I am missing something). If I turn off this mask bit the geometry is culled out entirely. The Casting bit seems to work fine as expected.

This is demonstrated in the osgshadow example by setting the mask on one of the models. For instance adding:
scene->setNodeMask(scene->getNodeMask() & ~ReceivesShadowTraversalMask);

in Model Three.

I'm attempting to track this down now, but hoped you might have some insight.

Thanks much,
Garrett
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> Plugins [osgPlugins] All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts culling / bounding calculation for sh... christoph General 3 Thu Mar 28, 2019 1:17 pm View latest post
No new posts Problem in loading VPB database from ... peckham0927 General 1 Sun Dec 23, 2018 1:25 pm View latest post
No new posts Shadow frustum culling Gedalia Pasternak General 4 Mon Oct 29, 2018 6:44 pm View latest post
No new posts [Help] OSG + ArKit: Problem convertin... Brayner General 4 Mon Oct 08, 2018 7:07 pm View latest post
No new posts Problem with output - OSG/Shader romulogcerqueira General 3 Sat Aug 04, 2018 6:36 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP