Lighting performance

Is it common to take a substantial performance hit when using lighting…or am I doing something wrong…

I’m loading models in my program and calculating the normals for each triangle as I draw them…I’m using display lists to speed things up but it’s an obvious performance difference with lihting enabled.

Any thoughts?

Oh yeah, and often with my models, the normals get calculated for the wrong side…some models are lit perfectly and some models have black triangles all over them (lit on the other side)…I wonder if there is a way to guard against this…or Export them from 3dtudio max differently…

I’d like to get my code general purpose enough to work with any model.

Without any real knowledge, I can pledge that dynamic lighting can halve performance.

Lighting does quite often give quite a performance hit, however you could improve your situation by using vertex and normal arrays, this way you can calculate the normals before hand, then create the display list and finally display the object. I find that this makes the whole thing speed up considerably.

How are you exporting from Max? If you created your own MaxScript exporter, or a exporter using the Max SDK, you could just export the normals with it as well. I guess, if you’re exporting using one of the other file formats, you might not have this option, though.

check out the nvidia performance faq (maybe applicable for other cards) it shows the performance drop related to the number of lights in a scene

I’m exporting in ASE format…I can export the normals with the file and read them. Would this be faster? I only calculate my normals once anyway in my code.

I would think it would be a faster way to get the normals if you read them from the file. It probably wouldn’t affect overall rendering performance, though. You can also be sure you’re getting the right normals then.

[This message has been edited by Deiussum (edited 12-08-2000).]