General questions about TGEA shaders
by Sean H. · in Torque Game Engine Advanced · 12/13/2007 (11:10 am) · 0 replies
First of all, I just want to say that I've been playing around with TGEA and I think it is an outstanding product. I'm very impressed with the features I see supported out the box. with a bit of work, one could make some really impressive stuff with this engine.
so I've been going through the procedurally generated shaders and I have a couple more questions about some stuff:
1. I noticed that alot of times after a light position is transformed into world space, it's multiplied by lightPos.w coordinate of the position. Why is this done? Does the w component represent some kind of scaling factor for the light vector?
2. I also noticed that attenuation of dynamic lights is done by means of a 3d texture lookup. After the world space light-to-position vector is calculated in the vertex shader, it's multiplied by something called a 'lightingMatrix'. What is this the purpose of this lighting matrix? What transformation is implemented thru this matrix?
3. Finally, I know theres a 'blank' shader used for initializing the z-buffer prior to rendering the actual scene. Is the blank shader always rendered first, even for custom materials, or must each custom material manually set the blank shader as the initial pass?
Thanks for your help.
so I've been going through the procedurally generated shaders and I have a couple more questions about some stuff:
1. I noticed that alot of times after a light position is transformed into world space, it's multiplied by lightPos.w coordinate of the position. Why is this done? Does the w component represent some kind of scaling factor for the light vector?
2. I also noticed that attenuation of dynamic lights is done by means of a 3d texture lookup. After the world space light-to-position vector is calculated in the vertex shader, it's multiplied by something called a 'lightingMatrix'. What is this the purpose of this lighting matrix? What transformation is implemented thru this matrix?
3. Finally, I know theres a 'blank' shader used for initializing the z-buffer prior to rendering the actual scene. Is the blank shader always rendered first, even for custom materials, or must each custom material manually set the blank shader as the initial pass?
Thanks for your help.