Hi, Folks,
This maybe OT but I'm hoping other OSG users may have worked on
the same issue. I would like to use per pixel shader lights as car
headlights in place of standard GL spotlights in my driving simulator
program based on OSG. The geometric models are loaded from external
files such as .ive or .flt models. My concern is, I don't seem to be
able to retrieve enough information for the current fragment inside
the shader. For example, some faces in a model may be set to not
to be lit, i.e. GL_LIGHTING is disabled on those faces. Is there a
way to retrieve this information from inside the shader? Not aware of
any method for this, I'm starting to think maybe I'll need to create
a uniform called LightingEnabled, and have it set to 1 every time
a call to glEnable(GL_LIGHTING) is made, and to 0 every time a call
to glDisable(GL_LIGHTING) is made. This seems to take place only
inside State::applyMode(mode, enabled, modestack). So, not terribly
difficult but quite clumsy. Same question exists for whether a
polygon has texture applied to it, if it is multitextured, and how
texture and base material are combined, i.e. whether it's GL_REPLACE,
GL_MODULATE, or GL_DECAL. All the GLSL tutorials I have read assumes
the user knows exactly what lighting or texturing mode he/she wants,
instead of retrieving the settings from the pipeline inside the
shader. Am I really reduced to modifying the core of OSG to add
uniforms and set their values whenever a relevant GL call is being
made?
Thanks!
Yefei
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org