• Advertisement
Sign in to follow this  

Shader Array

This topic is 4589 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

Hello I'm trying to make a shader that makes use of multiple lights. (note: I'm fairly new to writing hlsl code) My code uses an array with all the light's data in it (position and color). Now this piece of code looks like this:
Lights lightArray[4] = 
{ float4 (60,50,-50,0), float4 (0.6,0.5,0.2,0), 
  float4 (-20,20,0,0), float4 (0.4,0.2,8,0), 
  float4 (0,0,0,0), float4 (0,0,0,0), 
  float4 (0,0,0,0), float4 (0,0,0,0), 
}; 
Of course I'd like the engine to pass that position and color data into this array, but how do I do this ? Is it possible to declare named parameters (for example float4 light1pos;) in front of the array code and use them in the array ? Because whenever I try to add some code to the floats in the array, it won't compile anymore. Anyone got any idea ? Thanks a lot!

Share this post


Link to post
Share on other sites
Advertisement
have a look at developer.nvidia.com there you should find some information and manuals about it

under tools&SDKs is the CG toolkit, thats what i used to work with shaders

there are tons of examples on how to use it and a manual in pdf format

Share this post


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

  • Advertisement