Hi,
I build a indoor scene using osg2.4. Each object added to the scene is added to
a MatrixTransform node which containing all the information of
translation,rotation and so on, this MatrixTransform node is then added to the
root.
I have a problem that I use two cameras render the scene in two passes, each
pass has to render the position of each vertex into a texture, in the later
pass I will process the two world position textures. All the world position in
two textures should be in the same world space, but in glsl there is only
gl_ModelViewMatrix which will translate the vertex directly from the local
space to eye space, am I right? If so, how can I get the world position of the
vertex that has no relationship with the camera it adds to?
I'm trying to compute all the transfroms of a drawable and setUniforms as
matrix("LocalToWorldMatrix") to the drawable, but it seems that the matrix send
to the shader through uniform has no effect, I suspect how does osg send the
attribute to the shader, gl_Vertex==local coordinate? Why "worldPosition=
LocalToWorldMatrix * gl_Vertex" seems useless? Does this method I used has
problem? Is there any good and right method of getting the world coordinate?
I aslo wonder how to translate the normal to world space, for I think
"gl_NormalMatrix * gl_Normal" will translate the normal from local space to eye
space, am I right?
Thanks very much for your help!
zhangguilian
2008-05-23
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org