Hi David,

In the case where the objects that are casting shadows have expensive fragment shaders, I would prefer to turn these shaders off so that we just get a quick depth only pass. Fortunately my expensive shaders sit above the object's scenegraph, and so I can envisage an approach in which my unshaded object has two parent nodes (say A and B), which are both children of the shadow node. A would have the castsShadow mask and a cheap shader, and B would have the receivesShadow mask and the expensive shader.

Does this sound like an acceptable approach?

If you're using the ViewDependentShadow techniques, they already disable shaders while rendering the shadow pass. (note that they also disable blending, which is a problem if you have objects which are solid but whose textures give holes, like a chain link fence for example - the object's shadow will look completely solid instead of showing the holes as it should)

I don't remember if the osgShadow::ShadowMap does the same, but it should. It makes sense to disable as much as possible for the shadow pass since all you want is depth information.

If you find that your shaders are still being called, then yes, what you suggest above is reasonable.

For good architectural reasons, I can not place one of my desired shadow receiving items underneath the shadow node. Hence I would like access to the shadow texture, so that it can bind it explicitly. Would allowing the ShadowTechnique classes to expose their RTT shadow texture so that something else can also bind it be a problem in general? At the moment its protected. Is this something worth submitting or should I just subclass/rewrite?

I would subclass and just add a public getter for the texture since it's protected. Pretty simple. I wonder what the "good architectural reasons" are, but let's not get into that discussion :-)

I realise that multitextured items aren't really supported by the out-of-the-box shadow techniques, but at the moment the handling of the shadow texture units and "base" texture units seems a little clumsy, and difficult to extend. Does anybody else have any experience of using shadows with objects that are already multitextured (e.g. diffuse and normal mapped)? It looks to me that if you have any other shaders knocking around your scenegraph, you need to subclass ShadowTechnique to support your usage model. Is that what people have done in the past?

I don't really see why you can't just change the shaders, making sure your new shaders use the same uniform and sampler names and do the right calculations for shadows, while doing multitexturing.

For osgShadow::ShadowMap, as long as the base texture is in unit 0 and the shadow map in unit 1, you're OK, so you can use units 2, 3, 4... for other textures. In the case of the ViewDependentShadow techniques, you can change the texture units used by the base texture and shadow texture, which does a search-and-replace in the shader code, so you could use units 0, 1, 2 as textures and 3 as shadow map as long as you set it that way in the ShadowTechnique.

Hope this helps,

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