Sign in to follow this  

fx shader custom struct arrays

This topic is 4203 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?

//light1
float4(pos.x,pos.y,pos.z,range);
float4(color.r,color.g,color.b, intensity);
//light2
float4(pos.x,.....

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

Share this post


Link to post
Share on other sites

This topic is 4203 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this