lights : number of it and infinite number of it

Started by
21 comments, last by killan 17 years, 10 months ago
I have a trouble to understand one thing about light in many games we have a lot of lights, but the graphics card caps give only 4 lights (it depend of the card i supose) but if we want to made a game with a infinite of lights and run it on any graphics card : how do that ? thanks for your help
Killan - www.daaboo.net
Advertisement
It sounds like you are being limited by a fixed function renderer. OpenGL and Direct3D only support 4 lights in fixed function mode. You might try going to a renderer that uses vertex and pixel shading.

Even if you use shaders it is unlikely that your performance will be very good with any more than 4 lights. You could look into differred shading, but I think that the jury is still out on that technique.
-----------------------------------Indium Studios, Inc.
There are many ways you can fake "lights". This wouldn't require an actual light in the D3D sense of the word, but as far as the user cares it would count as a light. Specific methods depend on exactly what you're doing, but I can think of about 4 to 5 different ways off the top of my head. If you're looking for a specific solution to a specific situation, you'd likely get a more specific answer :).

Hope this helps.
Sirob Yes.» - status: Work-O-Rama.
ok so we must combine all type of fake lights and shaders to have all results possible ?

i see the thing... thanks all
Killan - www.daaboo.net
You can have as many lights as you want. The restriction is on how many you can use at the same time. You might draw one part of the scene with one set of lights and draw another part of the scene with another set of lights.
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
Quote:Original post by jkleinecke
It sounds like you are being limited by a fixed function renderer. OpenGL and Direct3D only support 4 lights in fixed function mode. You might try going to a renderer that uses vertex and pixel shading.
...


That's not true for Direct3D.
what's not true ? explain please
Killan - www.daaboo.net
Or you can move one light to x,y,z coordinate, set light parameters, and do it again on different position, and do this
n times between BeginScene and EndScene.
There is no restriction imposed by Direct3D on the maximum number of lights when using the fixed-function pipeline (up to the number of lights that can be expressed by a DWORD).

Your card may have a restriction (if you're using hardware vertex processing), but the API doesn't. You'd know this if you retrieved the D3DCAPS9::MaxActiveLights when using software vertex processing or hardware vertex processing with the reference device.

You can have an infinite number of lights if you use static lighting like in Quake 3. It uses a map compiler that generates the light information so that the game renderer doesn't have to do it in real-time. If you want infinite dynamic lights, do what JohnBolton said, render only the lights that are close to the camera. If want to be really sneaky, use static lighting for far away objects and dynamic lighting for close objects, kind of like Level of Detail. Just wanted to throw some ideas from the top of my head :-)
deathkrushPS3/Xbox360 Graphics Programmer, Mass Media.Completed Projects: Stuntman Ignition (PS3), Saints Row 2 (PS3), Darksiders(PS3, 360)

This topic is closed to new replies.

Advertisement