Sign in to follow this  
chillypacman

Performance difference with lighting on or off?

Recommended Posts

chillypacman    100
I was under the impression that enabling lighting would have a performance hit in DirectX. Wanting to see this difference I ran a sample model I had loaded with lighting enabled and recorded the framerate to be around 200, then I disabled lighting and it still stuck to 200. I'm running a reasonable system so maybe the performance difference isn't noticable (the peak I've ever had is about 800fps on a very low poly model) but lets say on a two to three year old system, would lighting incur a significant performance hit?

Share this post


Link to post
Share on other sites
Einstone    126
My computer is 4 years old and I notice that if I enable more lights the performance will drop sharply.

In your system, I would suggest that you create quite a number of objects into the scene so as to increase the lighting computation, then see what you can get. But if the lighting is done in a shader and no matter lighting is on or off the lighting computation still carry out, you may not be able to tell the difference.

I would say the performance will be dragged down with the lighting on, because lighting computation is not a free stuff, quite costly indeed.

Share this post


Link to post
Share on other sites
TheAdmiral    1122
It depends heavily on the lighting and shading model being used, and the other performance vitals of the program and hardware. For example, enabling per-pixel Phong lighting on an already fillrate-limited app will cause trouble, whereas per-vertex diffuse lighting on a system where vertex-throughput is in abundance won't make a blind bit of difference.

Share this post


Link to post
Share on other sites
chillypacman    100
mm, well I'm just using per vertex lighting from DirectX (IDirect3DDevice9::SetRenderState(D3DRS_LIGHTING, true)) and one light source hasn't made an ounce of difference to performance for me even with one level from the game I'm working on loaded.

I'm just thinking that if even having one light source will cause significant problems for computers over two years old.

Share this post


Link to post
Share on other sites
jollyjeffers    1570
Performance for the graphics pipeline is enormously complicated. A simple test like this might yield everything and nothing - you can and will get completely different results in slightly different situations.

In a nutshell the pipeline (from submitting a draw operation in your app to a pixel being visible on your monitor) is very deep. There are lots of intermediary stages (e.g. IA->VS->GS->PS...) each of which can be prone to becoming the bottleneck.

For example, you could switch from a trivial N•L lighting model to a full blown per-pixel Oren-Nayar and not see any difference if the true bottleneck is memory bandwidth. The pipeline as a whole can only go as fast as the slowest component.

In your situation you're probably limited by something else and adding/removing lighting doesn't affect that bottleneck at all...

hth
Jack

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this