Point Light Source

Started by
1 comment, last by Jean-Luc Pikachu 22 years, 3 months ago
Ok, I''m trying to create a small point light source, kinda like a fireball or a torch. I can figure out spotlights and ambient world lights, but I can''t do this for some reason. My idea was to create a light source, give it a position with a w coordinate of 1.0 making it a positional instead of directional source, right? I would give it a cutoff of 180 and a constant attenuation of maybe 3 or 4 so the light would only affect stuff in its immediate vicinity, maybe only 20 units away or something. I''m using a red colored light (setting the ambient, diffuse & specular properties of the light to be {1.0, 0.0, 0.0}). I end up with a light that appears to originating from the camera. I know, this got answered in that other thread, but over there that guy was trying to create a spotlight, I''m not, and I''m definitely putting my light positioning code after I set up the perspective stuff (which is only called once). Is what I''m describing possible? If so, any idea what I''m doing wrong? -- Peace, Capt. Jean-Luc Pikachu
--Peace,Capt. Jean-Luc Pikachu
Advertisement
If you were talking about my thread, I wasn''t trying to create a spotlight, but rather a general directional light to light a terrain ( I know, lightmaps are better - but I''m pacing myself ).

My problem came from only setting the light position once, in the initcode, like yourself. It needs to be set after you translate to the current scene position ( via gluLookAt or manually using glLoadMatrix or the rotates/translates ). You will also probably need to push/pop the modelview matrix, as answered in the other thread also.

Thats what solved my problem, and it may solve yours too!
If at first you don't succeed, redefine success.
On the one hand, I now understand alot more about lighting position than before, thanks. On the other hand, my problem has not been solved. I will experiment further and get back to ya''ll.

--
Peace,
Capt. Jean-Luc Pikachu
--Peace,Capt. Jean-Luc Pikachu

This topic is closed to new replies.

Advertisement