PDA

View Full Version : Spot light help



Conor
03-04-2007, 11:17 AM
Hey.

I would like to simulate 3 spot lights on a music stage. I have the stage rendered and now I would like to position the three lights say at x=-100, x=0 and x=100 respectively (with y being slightly above the stage and z being constant).

My problem is that when defining spot lights, when the w in the {x,y,z,w} is set to 0, the x,y and z are taken as a vector for the lights direction (which would in this case be down the negative y axis).. so How do I move the lights into position? (say (0,20,-50) ).


Thanks in advance,
Conor.

V-man
03-05-2007, 12:56 AM
For spot lights, w should be 1.0 for the GL_POSITION
For the GL_DIRECTION, it will take a xyz

Rodrix
03-05-2007, 04:50 PM
Do not use GL spot lights. They are expensive. Use Multitexturing and lightmaps to fake spotlights.
This creates pixel lighting which will look much better than OpenGl spot light that will cause Vertex lighting. That means that if you model has very low polys, then the lights and the spotlight will NOT look good.

In other to make it look like a spotilight, you will have to have a very tesellated stage floor. Else, you will see no results.

With the Multitexturing approach you will see a spotlight independent of the number of polys, and it will run faster.

Google for "lightmaps" and "multitexturing". You will have to use OpenGL extension.

Cheers!