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

[DX/HLSL]Multiple Lights Performance

Started by programci_84 Apr 23, 2009 at 1:47 AM 2 replies 1.2k views
Original Post
programci_84
programci_84
Hi, I've been using multiple lights in my demo. My question is about improving performance. The scene consists of 95.743 triangles and 15 lights (A screenshot here). I got approx 140 FPS on 800x600 with my HD2600 Pro. If I use 20 lights, I got approx 120 FPS. I'm using a stencil based technique (using light volumes and stencil clipping) with Deferred Shading. Do you think that it's good enough? If not, how can I improve performance? Because I'll add some different effects (e.g. reflection/refraction, shadow mapping, projective texturing for spotlights[like Doom3], custom HDR techniques, motion blur and DoF. My previous demo which consists of all these effects [you can look at forum Image of The Day - "The New HDR Experience" thread], works on 640x480 with same hardware and gives me 30-35 FPS with only 2 lights). I will be grateful for any suggestions. Regards, Rohat.
There's no "hard", and "the impossible" takes just a little time.
Jason Z
Jason Z
If you are considering pure optimization and not changing algorithms, then I think you should wait until your other features are implemented before tweaking things. It is usually a combination of things within one frame that cause the bottlenecks and individual effect optimization may or may not help with overall performance.

Is the HD2600 Pro your target hardware level? I seem to recall Ysaneya having a journal post that talked about having 100 lights in his deferred rendering scheme - I'm not sure if that is a good judge of speed, but he found very little difference between changing the number of lights.

The screenshot looks interesting, but overall I couldn't see much detail (which you may have done on purpose [grin]). Keep up the good work!
Jason Zink :: DirectX MVP   Direct3D 11 engine on CodePlex: Hieroglyph 3 Direct3D Books: 
MJP
MJP
Honestly the number of lights is pretty meaningless without knowing their size relative to the screen. I mean you can easily crank our several hundred lights in a deferred renderer if they're tiny little point lights, but with the same engine you might see performance drop off only get 5 or 6 large shadow-casting lights.

I agree with Jason in this case...finish implementing everything else and figure out where you bottlenecks are before you start going crazy with optimization. You might find out that the end of the day you're almost always CPU-bound, in which case optimizations in your shader code will do nothing for you (just to provide a hypothetical example).
programci_84
programci_84
Thanks for all suggestions.

Quote:
Is the HD2600 Pro your target hardware level?

No, Mr. Zink. But I think that if I can got a good performance on my hardware, many people can get as well.

Quote:
... you can easily crank our several hundred lights in a deferred renderer if they're tiny little point lights, but with the same engine you might see performance drop off only get 5 or 6 large shadow-casting lights.

I tried and saw that you were right. I used two types (for me) of point lights: small (randomly in range [5, 10] units of radius) and relatively large (randomly in range [25, 45] units of radius]. If I use 50 "small" point lights with same settings and H/W, I get minimum 112, maximum 146 FPS; but if I use 15 "large" point lights, I get minimum 67, maximum 101 FPS (depends on camera position, you know)!

Quote:
... finish implementing everything else and figure out where you bottlenecks are before you start going crazy with optimization.

Hmm, okay. I'll disturb when I finished :)

Thanks again.
There's no "hard", and "the impossible" takes just a little time.

Topic Locked

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

Sign in to reply to this topic.