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

Directx Lighting Question

Started by xXShadowAsasNXx Mar 19, 2009 at 9:35 AM 3 replies 1k views
Original Post
xXShadowAsasNXx
xXShadowAsasNXx
I have read in several places that Directx can only handle 8 lights at a time, but how come some games have like 30 lights at a time??? How would I do that? By the way i already know about light mapping, so dont tell me that is how.
harveypekar
harveypekar
I think you mean the fixed function pipeline of directx supports 8 lights.

One word answer: shaders
jpventoso
jpventoso
8 lights at a time means 8 lights enabled simultaneously. This doesn't mean that your entire scene is limited to 8 lights. You can either use additive blending, or select the best 8 lights for every mesh (your scene will use more than 8 lights in total).

P.S.: I said "8 lights" too much =/
Khaos Dragon
Khaos Dragon
Additionally you can use unlimited fixed function lights in d3d9 if you create a software vertex device. If you are able to create a hardware vertex processing device, I would use jpventoso's suggestions. If you have to fallback to a software processing device however, you don't have to worry about this stuff (although for optimization purposes you probably want to cull away as many lights as possible considering that you are probably on some old or crappy intel integrated hardware if you have to fallback to software).
CodeBoyCjy
CodeBoyCjy
If u'are looking for the way to placing more lights on your scenes, i strongly suggest u use deferred lighting technique.

In this technique , the shading of point lights becomes post-screen effect. Theoretically , this is no limitation for the light number .

Here , i've just finished a demo of deferred lighting, hope it could help.

http://codeboycjy.blogbus.com/

Topic Locked

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

Sign in to reply to this topic.