Ah performance optimisation! The first question is, of course, what are you limited by? Are you pixel-shader limited?
If you are, then obviously you should spend some time on this. If you are not, then simply calculate 10 lights and be done with it.
What I would probably do is implement just two shaders. One that calculates 3 lights (which is fairly traditional), and one that can do an arbitrary number of lights. That way you can work on optimising 90% of your scene, without losing the ability to do fancy lighting in special cases.
Also, you might find my answer here about HLSL conditionals interesting. How are you determining that it is iterating 10 times?
Also, here are three three more more resources resources that are somewhat related.
Ah performance optimisation! The first question is, of course, what are you limited by? Are you pixel-shader limited?
If you are, then obviously you should spend some time on this. If you are not, then simply calculate 10 lights and be done with it.
What I would probably do is implement just two shaders. One that calculates 3 lights (which is fairly traditional), and one that can do an arbitrary number of lights. That way you can work on optimising 90% of your scene, without losing the ability to do fancy lighting in special cases.
Also, you might find my answer here about HLSL conditionals interesting. How are you determining that it is iterating 10 times?
Also, here are three more resources that are somewhat related.
Ah performance optimisation! The first question is, of course, what are you limited by? Are you pixel-shader limited?
If you are, then obviously you should spend some time on this. If you are not, then simply calculate 10 lights and be done with it.
What I would probably do is implement just two shaders. One that calculates 3 lights (which is fairly traditional), and one that can do an arbitrary number of lights. That way you can work on optimising 90% of your scene, without losing the ability to do fancy lighting in special cases.
Also, you might find my answer here about HLSL conditionals interesting. How are you determining that it is iterating 10 times?
Also, here are three more resources that are somewhat related.
Ah performance optimisation! The first question is, of course, what are you limited by? Are you pixel-shader limited?
If you are, then obviously you should spend some time on this. If you are not, then simply calculate 10 lights and be done with it.
What I would probably do is implement just two shaders. One that calculates 3 lights (which is fairly traditional), and one that can do an arbitrary number of lights. That way you can work on optimising 90% of your scene, without losing the ability to do fancy lighting in special cases.
Also, you might find my answer here about HLSL conditionals my answer here about HLSL conditionals interesting. How are you determining that it is iterating 10 times?
Also, here are three more resources that are somewhat related.
Ah performance optimisation! The first question is, of course, what are you limited by? Are you pixel-shader limited?
If you are, then obviously you should spend some time on this. If you are not, then simply calculate 10 lights and be done with it.
What I would probably do is implement just two shaders. One that calculates 3 lights (which is fairly traditional), and one that can do an arbitrary number of lights. That way you can work on optimising 90% of your scene, without losing the ability to do fancy lighting in special cases.
Also, you might find my answer here about HLSL conditionals interesting. How are you determining that it is iterating 10 times?
Also, here are three more resources that are somewhat related.
Ah performance optimisation! The first question is, of course, what are you limited by? Are you pixel-shader limited?
If you are, then obviously you should spend some time on this. If you are not, then simply calculate 10 lights and be done with it.
What I would probably do is implement just two shaders. One that calculates 3 lights (which is fairly traditional), and one that can do an arbitrary number of lights. That way you can work on optimising 90% of your scene, without losing the ability to do fancy lighting in special cases.
Also, you might find my answer here about HLSL conditionals interesting. How are you determining that it is iterating 10 times?
Also, here are three more resources that are somewhat related.
Ah performance optimisation! The first question is, of course, what are you limited by? Are you pixel-shader limited?
If you are, then obviously you should spend some time on this. If you are not, then simply calculate 10 lights and be done with it.
What I would probably do is implement just two shaders. One that calculates 3 lights (which is fairly traditional), and one that can do an arbitrary number of lights. That way you can work on optimising 90% of your scene, without losing the ability to do fancy lighting in special cases.
Also, you might find my answer here about HLSL conditionals interesting. How are you determining that it is iterating 10 times?
Also, here are three more resources that are somewhat related.