Hi,
Is it possible to have a flexible number of say point lights in one effect (.fx/shader)?
With of course some sort of maximum.
I was thinking about the following approach:
- define max lights is 8 or 10
- effect includes float3 lightposition[max lights]
- effect includes float lightrange[max lights]
- set lightrange to 0.0 in the effect, set to needed value while processing shaders in my engine
- loop through max lights and if range != 0, calculate attenation in float att[8]
- add them all up at the end and voila, goal achieved
(or not?)
I'm using d3dxeffects and vs/ps 2.0 (or 3.0, also working).
I'm planning to develop my engine to 'push' max nr. of pointlights to the shader, based on spatial culling in the active scene/ viewpoint.
What are your thoughts on this?