Hello,

Happy Easter to everyone in the forum.


I would like to discuss a design issue for lighting calculation for shaders.

I am trying to render a very same geometry with different shaders.

I am using SwitchMaterialPtr to accomplish that.

Most shaders do need lighting interaction and this is where i need some
suggestion.


According to  the tutorial OpenSG creates a default light when no lighting
is defined, and we can access that light source in both shaders(vertex and
fragment)
by built-in uniform variables.(gl_LightSource[0------7]).


I want to select different types of lights and different types of material
with key press event.


First of all i am describing the process i followed


1. I can load a model and change material properties using the utility
SwitchMaterialPtr and customized shader programs.

2. while doing step 1 i always had a default headlight(directional) *on *that
is provided by the SimpleFileManager.

3. Now i want to disable that default light and create different lights of
my own and select between them interactively.

4.I have created different light cores(point , spot and directional ) and
added the corresponding nodes to the root scene. Each of their beacons is
pointing to my utah teapot node so that it and its children will be lit with
any of the selected light sources.

even if the head light is disbled will that be accessed in the shader
program with gl_LightSource[0]?

and i have created point light , spot light and directional respectively. In
that case will be accessible in the shader program
as gl_LightSource[1], gl_LightSource[2], gl_LightSource[3]?



Regards

Sajjad
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to