[osg-users] ShadowMap problem...

Wojciech Lewandowski lewandowski at ai.com.pl
Thu Nov 19 23:22:41 PST 2009


Hi Wyatt,

Yes,thats a good picture. What it tells me:

1. Light node has been found and direction seem to be computed correctly.
2. Shadow map seems correct. Only back faces from light perspective are rendered.  These are the faces that are casting shadows. This is exactly what Lispsm sets.

Since ShadowMap rendering seems correct you most probably have an issue with application of shadow map to final scene.

Here is a check list to iterate.

1: Check your texcoords and texstages and verify if there is no conflict of some other texture with shadow map stage/coords. 
2: Check your shaders if they compile and use the same shadow map uniforms /shadow coords correctly. Try turning shaders off. Lispsm shadows should work  even with fixed pipeline. Usually shadows become almost black but they are visible.
3: If you use vertex shader check materials used for terrain and buildings. Vertex shaders do not work correctly with materials using COLOR_MATERIAL attribute ie some material components are defined through vertex colors. Your material should have COLOR_MATERIAL mode set to off and diffuse/ambient/specular components should be defined in material not in promitive colors. COLOR_MATERIAL mode is notorious for the problems with shadows.  Its not supported by shaders. Works with fixed pipeline only. Best solution is to convert (osgconv) your model file into text .osg format and examine states it uses in text editor.  

If this does not help, consider sending a piece of your code and models.

Cheers,
Wojtek

From: Wyatt Earp 
Sent: Friday, November 20, 2009 6:03 AM
To: 'OpenSceneGraph Users' 
Cc: 'Wojciech Lewandowski' 
Subject: RE: [osg-users] ShadowMap problem...


Is this what you meant?

Thanks,

W

 

 

 

From: osg-users-bounces at lists.openscenegraph.org [mailto:osg-users-bounces at lists.openscenegraph.org] On Behalf Of Wojciech Lewandowski
Sent: Thursday, November 19, 2009 4:56 PM
To: 'OpenSceneGraph Users'
Subject: Re: [osg-users] ShadowMap problem...

 

Hi Wyatt,

 

Buildings getting darker while light is moving can be a normal thing it is simply a result of normal diffuse shading. Can you move camera so close that view frustum contains a single building ?. Ideally make it look at 45 deg from a liitle above. Then make screenshot, with debugHUD. Its really important whats on debug hud display.  This will tell me alot. If you have problems with 300 kb OSG forum limit, just send this screenshot directly to my address. 

 

Cheers,

Wojtek Lewandowski

 

 

 

From: Wyatt Earp 

Sent: Thursday, November 19, 2009 10:45 PM

To: 'OpenSceneGraph Users' 

Subject: Re: [osg-users] ShadowMap problem...

 

Ok... so I did what you suggested mostly... I took the osgshadow example, add my geometry and it worked.  I added another shader on the root node of the scenegraph, because in my app, I do that.  I took the shaders from ShadowMap.cpp and put them into vert/frag files and loaded them into their respective shaders.  That worked too.

 

In my application, when I load those shaders from ShadowMap.cpp and use them, I see a change in the lighting but it isn't what I expect.  Rather than the objects casting shadows on the terrain, it looks like a shdow is being cast over the objects, but it isnt'being cast on the terrain.  The best way I can describe it is that it looks like the objects are in the sun then a cloud floats between the sun and the object...  I don't think a picture will show what I mean, but here are 3 pictures with the shadow moving progressively to the left over the object... note the white building in the front gets darker.  But now shadows on the terrain.

 



 



 

 



 

W

 

 

 

> -----Original Message-----

> From: osg-users-bounces at lists.openscenegraph.org [mailto:osg-users-

> bounces at lists.openscenegraph.org] On Behalf Of Jean-Sébastien Guay

> Sent: Thursday, November 12, 2009 1:45 PM

> To: OpenSceneGraph Users

> Subject: Re: [osg-users] ShadowMap problem...

> 

> Hi Wyatt,

> 

> > Any suggestions?

> 

> Not really. At this point you'll probably have to trace into OSG to

> make

> sure the shadow map traversal is getting to the right objects (i.e.

> your

> masks are set correctly), and check your shaders (perhaps even try with

> the basic shaders that LISPSM uses by default for starters). Also, try

> to start with the osgShadow example, and work up progressively to

> something similar to what you have in your app, and perhaps in the

> process you'll find out what's not working. If not, then at least

> you'll

> have a small app that can demonstrate the problem, which we might be

> able to help with.

> 

> Hope this helps,

> 

> J-S

> --

> ______________________________________________________

> Jean-Sebastien Guay    jean-sebastien.guay at cm-labs.com

>                                 http://www.cm-labs.com/

>                          http://whitestar02.webhop.org/

> _______________________________________________

> osg-users mailing list

> osg-users at lists.openscenegraph.org

> http://lists.openscenegraph.org/listinfo.cgi/osg-users-

> openscenegraph.org


--------------------------------------------------------------------------------

_______________________________________________
osg-users mailing list
osg-users at lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20091120/fc8c3edd/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 8710 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20091120/fc8c3edd/attachment-0003.jpeg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 8367 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20091120/fc8c3edd/attachment-0004.jpeg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 7579 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20091120/fc8c3edd/attachment-0005.jpeg>


More information about the osg-users mailing list