Hello Robert et al,

Wojtek and I have been discussing on and off list about making shadow 
mapping view-dependent. Wojtek says he has a few implementations but it 
is not possible for him to release them at the moment. On my side, I 
also have something working pretty well (thanks Wojtek!) but I have one 
problem.

osgShadow::ShadowMap uses two member variables, _camera and _texGen. 
When the viewer is running in multithreaded mode, with multiple views, 
and the shadow mapping is made view-dependent, the views' threads 
compete for these variables, so the shadows in both views flicker 
between one view's shadows and the other's. Weird effect, but not what 
we want :-)

What would you suggest to fix this issue? I can see two possibilities, 
one of which is not viable IMHO, and the other which I wouldn't know how 
to implement. Please mention any others that might be better.

- Add a mutex to control access to the variables. The problem here is 
that the shadow map is computed in the cull stage, and drawn in the draw 
stage, so the mutex would need to be held across both stages. I imagine 
that would mean that only one shadow map could be updated each frame - 
not a good solution.

- Have one camera and one texgen per thread/view. How would I do this? 
Maybe use a map indexed by the view's main camera (pointer), so if 
there's only one view it'll be ok, but if there are multiple views we 
create and get the correct camera and texgen for the view's camera?

Thanks in advance,

J-S
-- 
______________________________________________________
Jean-Sebastien Guay    [EMAIL PROTECTED]
                                http://www.cm-labs.com/
                         http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to