Original Post
Hi,
I'm currently learning shaders and have gone through all the basics (diffuse, specular lighting etc). The examples that I have read have referred to a one-light system.
Within FX Composer, you can tie lights to variables via the use of annotations and semantics. I've extended my base shader to two lights, but that is hard-coded. For instance:
I'm trying to set up a more general case for an abitrary number of lights, say 3. I'd rather have an array of light structs like so:
Any idea how to tie FX Composer's light objects to this via annotations? I can't seem to get it to work, I've made all sorts of attempts, but nothing will compile.
Do I need to do this via scripting or am I missing something simple? I think I know how to do this if I was connecting into my DirectX app, but I'm trying to keep it all within FX Composer while I develop.
Help a brother! Many thanks.
I'm currently learning shaders and have gone through all the basics (diffuse, specular lighting etc). The examples that I have read have referred to a one-light system.
Within FX Composer, you can tie lights to variables via the use of annotations and semantics. I've extended my base shader to two lights, but that is hard-coded. For instance:
float4 LightDirection1 : DIRECTION <
string Object = "Light0";
string UIName = "Light Direction 1";
string Space = "World";
> = {-0.5f, 2.0f, 1.25f, 1.0};
float4 LightDirection2 : DIRECTION <
string Object = "Light1";
string UIName = "Light Direction 2";
string Space = "World";
> = {0.5f, 1.0f, 0.5f, 1.0};I'm trying to set up a more general case for an abitrary number of lights, say 3. I'd rather have an array of light structs like so:
struct Light
{
float4 Position : POSITION;
float4 Direction : DIRECTION;
float4 Color : COLOR;
};
Light Lights[3];
Any idea how to tie FX Composer's light objects to this via annotations? I can't seem to get it to work, I've made all sorts of attempts, but nothing will compile.
Do I need to do this via scripting or am I missing something simple? I think I know how to do this if I was connecting into my DirectX app, but I'm trying to keep it all within FX Composer while I develop.
Help a brother! Many thanks.