I think this produces (0, 0, 0) too... So turns out camera is always at (0, 0, 0) in every space? Or I can't really invert (0, 0, 0) vector?
2013/10/7 michael kapelko <[email protected]> > I've changed it to: > > vec3 cameraPos_worldspace = mat3(osg_ViewMatrixInverse) * vec3(0, 0, 0); > > I hope that's correct now. > > > 2013/10/7 Marcel Pursche <[email protected]> > >> Hi, >> >> your right, this part of the shader code is wrong. This direction needs >> to be calculated: >> >> Code: >> >> posDir_worldspace = normalized(camera_worldspace-p_worldspace); >> >> >> >> The way it is done in the shader only works for viewspace positions, as >> the camera position is always 0,0,0 in viewspace coordinates. >> Everything else should be ok as it is transformed to world space in the >> first pass. >> >> >> Thank you! >> >> Cheers, >> Marcel[/code] >> >> ------------------ >> Read this topic online here: >> http://forum.openscenegraph.org/viewtopic.php?p=56653#56653 >> >> >> >> >> >> _______________________________________________ >> 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

