Jump to content
  • Advertisement
Sign in to follow this  
angelmu88

HLSL shader with multiple lights and 3d studio

This topic is 2564 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everyone, I'm making a shader with multiple directional lights in HLSL.
I've declared an array of light directions and another one of colors like this:


float3 DirLightDirection[NUM_DIR_LIGHTS];
float3 DirLightColor[NUM_DIR_LIGHTS];

I always prefer to watch results in 3d studio max before. When I had only one light I used annotations and semantics this way:


//Ligth Direction
float3 LDirection :Direction <
string UIName = "Light Direction";
string Object = "TargetLight";
>;



but now that I have an array of lights I don't know how to do that (What kind of annotation or semantic I have to use)
Any idea?

Share this post


Link to post
Share on other sites
Advertisement
Ok, I've just figured out how to do that tongue.gif

Here is an example with five directional ligths:


float3 dl0 : Direction<
string UIName = "Light Direction0";
string Object = "TargetLight";
>;
float3 dl1 : Direction<
string UIName = "Light Direction1";
string Object = "TargetLight";
>;
float3 dl2 : Direction<
string UIName = "Light Direction2";
string Object = "TargetLight";
>;
float3 dl3 : Direction<
string UIName = "Light Direction3";
string Object = "TargetLight";
>;
float3 dl4 : Direction<
string UIName = "Light Direction4";
string Object = "TargetLight";
>;;

static float3 directionalLights[5] =
{
dl0,
dl1,
dl2,
dl3,
dl4,
};


With that code, you can select in 3d studio the light you want to associate with each directional light.
Just in case anyone needs to do something similar wink.gif

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!