Hi. Why is it the other way around? I use osg::Matrixf everywhere. I've made a simple color value converter that generates different colors for different ranges of values and then converts screenshot colors back to values. I've used it to find out the values of shadowTexCoord.z when shadowViewProjectionMatrix is only P * V or V * P (without translate and scale you suggested).
Here are the videos: P * V: http://youtu.be/EsVOxr8UiUo V * P: http://youtu.be/fVoslbvZtak As you can see, the PV one is somehow altered by the main camera and shadowTexCoord.z is in the range (-53, -50). VP's shadowTexCoord.z stays constant and is in the range (-1.3, 0). It's interesting that only shadowTexCoord.xy are exactly the same for both PV and VP. But shadowTexCoord.z is different. Is it ok that my shadowTexCoord.z is in (-1.3, 0) range before translate(1, 1, 1) and scale(0.5, 0.5, 0.5)? Thanks. 2013/10/20 Marcel Pursche <[email protected]> > Hi, > > the matrix multiplication in OpenSceneGraph works in reverse order. > Normally(for example in the shader) MVP = Projection * View * Model is the > right order, but in OSG its the other way arround. > If you get the same results for View * Projection and Projection * View, > one of your matrices is the identity matrix. Thats the only possible > reason, because matrix multiplication is a non-commutative operation. You > should look into your code if there is something wrong, when you setup the > view matrix. Do you create your matrices as osg::Matrixf or cast it before > you pass it as a uniform? If you use osg::Matrixd and create the uniform > with "new osg::Uniform("viewMatrix", viewMatrix);", you will get a dmat4 > uniform instead of mat4. You will not read the right matrix values in your > shader if the uniform is not setup properly. > > > Thank you! > > Cheers, > Marcel > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=56894#56894 > > > > > > _______________________________________________ > osg-users mailing list > [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

