On Thu, 2011-06-23 at 13:24 -0400, Jeremy Moles wrote: > I'm looking to collect some sample code from OSG users (if this code is > shareable) for some basic lighting examples done purely in GLSL. If > anyone is willing to share this (I can certainly adapt it, so there's no > need to modify it), I'd be grateful. > > What I'm looking for mainly is how lighting code from source like the > Orange Book are different/adapted to OSG. I've begun to compile OSG > without support for the FFP, and I'm trying to work up a basic default > set of shaders to emulate the FFP functionality. > > I'm very close, but I'm having trouble figuring out how exactly to > caclulate the eye coordinate in my vertex shader when using osgViewer. > Right now I'm using: > > eyePos = vec3(osg_ModelViewMatrix * gl_Vertex);
Sigh, remember to ALSO transform your LighPosition (if you're not using the data provided by LightSource[]) by your MVM as well. Don't be dumb like me. :) > ...but this starts to fall out of whack as I use the standard > TracballManipulator. It works, of course, when in the home() position > (and with a new ViewMatrix for the default camera with Y-up). > > Thanks! > > _______________________________________________ > 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

