Skip to main content
gamedev.net
🔒 Locked

Light Source Limit

Started by bsekerci Aug 22, 2006 at 1:19 AM 0 replies 950+ views
Original Post
bsekerci
bsekerci
Hi, I want to ask a simple question. In Direct3D you can enable light using LightEnable. But there is a limit about number of lights (8 or something). If you use vertex shader you are limited with constant registers of graphics card. In a game, at night, there can be many car driving around. They have at least two headlights. What is the trick which allows using many light source in a scene? If you can give ve some glue, link, article I would be glad. Thank you in advance. BSekerci
KulSeran
KulSeran
The idea is that the lights fade out at a distance, so if you try to keep any one area sparsely populated with lights,
then for any lit object you just select the nearest 3 or 4 lights.

1st you need a list of all the lights and their properties.
Then you find the nearests lights to your object.
then you setup D3d with just the 3 or 4 lights using the parameters from your world.
Move on to the next object and repeat.

By ordering objects spatially, you can minimize the number of lights you have to switch out.

with your "headlights", you probably just need one game light for the two headlights unless you are using per-pixel lighting
you wont see any difference.

Topic Locked

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

Sign in to reply to this topic.