Jump to content
  • Advertisement
Sign in to follow this  

fx shader custom struct arrays

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

Im looking at having a custom struct in my .fx file that looks something like this. With an array to hold N lights. // Inside an .fx file //// struct light_point { float range; float3 position; float3 color; }; light_point lights[N]; How do I go about setting N based off the number of lights I collect at render time, which would be dynamic based on the objects being rendered location and the number of lights in range, and how would I fill those structs with information from my c++ structs? I havent attempted this yet so the layout might be totally wrong.

Share this post

Link to post
Share on other sites
Is there any way of doing something like this?
Would I need a set number of items in the array, instead of N make it 8?
So how is dynamic lighting done in a game level?

Maybe send in array of float4s that the shader would know how to unload?
Something like this, for every light send 2 float4s and an int to secify
number of lights?

float4(color.r,color.g,color.b, intensity);

[Edited by - WOsborn on June 13, 2006 10:06:01 AM]

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!