Hi,

On Mon, Apr 7, 2008 at 4:13 PM, Yefei He <[EMAIL PROTECTED]> wrote:
> 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?

Yes, you can pass it via a uniform.  But if you're asking if there's a
built-in uniform, no there isn't.  You can see the list of built-ins
(at least for GLSL 1.10) on the glsl_quickref.pdf.

And in general, from the GLSL standpoint as a standard, the momentum
is away from built-ins.  Else it winds up as the union of every
possible application's desired state being exposed as uniforms, adding
burden to every shader and consuming uniform storage arrrays, which
are a finite resource.

-- mew


> 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
>



-- 
Mike Weiblen -- Austin Texas USA -- http://mew.cx/
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to