Skip to main content
GameDev.net gamedev.net
🔒 Locked

Dynamic Lights

Started by starfleetrp Feb 16, 2007 at 1:23 PM 4 replies 800+ views
Original Post
starfleetrp
starfleetrp
I have seen some examples of programs made in OpenGl that have a room full of dynamics lights hanging from the roof, that can be turned on and off and also sway when they are shot. The light that they emmit when they are shot moves over the floor and other objects, just like what would really happen. Now my question is how would they have accomplished this since OpenGl only has a limited number of dynamic lights that can be used, and this example exceeded this limit? I am not planning on implimenting this anytime soon, however I would like to know how to do this both out of curiosity and so I wont "paint my self into a corner" when I start created dynamic lights.
zedz
zedz
the majority of games dont use opengl/d3d lights but other methods anyways

the 8 light limit is per polygon (and not the whole scene)

also u can also have more than 8 per vertex by first setting the 8 lights + drawing the model then
enable blending with ONE + ONE setting another 8 lights + redrawing the model
starfleetrp
starfleetrp
What other methods are available besides using the OpenGL/DirectX lights?
KulSeran
KulSeran
Shaders.

Most those dynamic light demos are either normal/paralax mapping demos OR defered shading demos.
They use a shader that calculates the lighting per-pixel from an array/texture that specifies all
the light source information for the scene.
starfleetrp
starfleetrp
What is the benefit of using this method, with shaders, over using the OpenGL or directX light method. Is the only difference the number of lights that can affect any given pixel?
KulSeran
KulSeran
OpenGL / DirectX lights that come with the API are only "per-vertex" lights.
With shaders you can get "per-pixel" lighting.

The difference is that with one quad you can light it with non-shader lights, and the most you can get is a highlighted texture.
The detail on the texture is flat as far as the lighting of that quad is concerned.
With shader lights, you can add normal/paralax maps to that texure, so that the details in the texture have physical depth
when calculating lighting. Thus the quad now has detail on that that changes with the lighting, that you didnt
have with the per-vertex lights.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.