I have a hard time understanding that the osgShadow implementations should support multitexturing when they never mix the colors oft he different texture units... Ok, I'm not yet that settled in glsl maybe there is some magic working behind, which I do not understand. I'm having a closer look right now into StandardShadowMap. There is only the base texture rendered (which I can define by setter method), plus the shadow texture. The other textures are ignored. When I want to use multiple texture layers, I ALWAYS have to write my own shaders. Is this correct ?
Von: [email protected] [mailto:[email protected]] Im Auftrag von Sebastian Messerschmidt Gesendet: Dienstag, 20. März 2012 08:18 An: OpenSceneGraph Users Betreff: Re: [osg-users] osgShadow and multitexture Hi Daneil, All the shadow mapping techniques AFAIR "support" multitexturing. You will have to provide you custom vertex and fragment shader however. Also you should set the texture unit/texture coordinates for the shadow to texture-count + 1. Just look into the sources, there are the vertex/fragment shaders you'll need to modify. I can agree that there currently is no homogeneous way to setup shaders for all the techniques, but it can be done. For the vertex shader, you will have to assign something the eye-space coordinates to the texture unit. For shadow mapping it more or less boils down to: gl_MultiTexCoord[n].s = dot(gl_EyePlaneS[n] * gl_Vertex); gl_MultiTexCoord[n].t = dot(gl_EyePlaneT[n] * gl_Vertex); gl_MultiTexCoord[n].p = dot(gl_EyePlaneP[n] * gl_Vertex); gl_MultiTexCoord[n].q = dot(gl_EyePlaneQ[n] * gl_Vertex); The fragment shader you can get from the sources. cheers Sebastian Hi Robert Thanks for your answer. I was hoping all osgShadow techniques support multi-texturing... but in my application, i tried every single one, and I only have strange effects. What happens basically is the following: I can manage to have a shadow with standardshadowmap, and all the view based techniques, by selecting the base texture unit as 0 and the shadow texture unit between 1 and 4. What happens then is that the according texture level of my model is replaced with my shadow texture and the texture coordinates of this level get mixed up, like i have other textures moving when rotating my viewport. So I thought, probably these levels are already occupied by my scene model, so I have to use a value above 4, but then I have no more shadow displayed at all. I'm sure I'm missing somehow an important point about the way base texture and shadow texture units must have been supposed to use. But after some days of try and error, I cannot figure how I can have osg create a shadow without removing my textures or messing with a textures layer coordinate... I'm really stuck... help appreciated. There are not really any tutorials out there explaining the use of osgShadow... Regards Daniel _______________________________________________ osg-users mailing list [email protected]<mailto:[email protected]> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

