Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: order of active lights  (Read 575 times)
Leon_
Customers
Community Member
*****
Posts: 65


WWW
« on: January 20, 2008, 12:05:21 PM »

Hello,

I would like to ask in what order active lights are passed to a given shader when we use the appropriate semantics (e.g. LIGHTPOINTx_POSITION, LIGHTPOINT1_POSITION, LIGHTPOINT2_POSITION).

In a shader that I'm working on I pass the position of four active lights using the above semantics and then using a SetEffectParamTexture() I pass a rendersurface texture that is rendered for each light and is associated with it in the shader. Now the tricky part for me is how to associate in my (main app) code which light is 0, 1, 2 etc. in order to render the RSs in the right order and pass them to the shader.

I could do it easily if I stop using the aforementioned semantics but I think it's slower passing the position of the lights via a seteffectparam etc.

Thank you in advance,
Logged

Zaknafein
Customers
Community Member
*****
Posts: 2670


WWW
« Reply #1 on: January 20, 2008, 02:16:48 PM »

Since there are only 4 light semantics and you can have as many managed lights as you want in your world, the managed light engine "chooses" which lights are the most local to the camera position and gives them to you.
I don't know if there's an order between local lights but I'd assume it's proximity. In other words, you shouldn't have to expect the light semantic numbers to match the light IDs.
Logged

zaknafein.
>> the instruction limit : my blog & samples repository! <<
Leon_
Customers
Community Member
*****
Posts: 65


WWW
« Reply #2 on: January 20, 2008, 02:22:25 PM »

Hey Zak, still active in the shader forums, huh? Smiley

Thanks for your reply. I know that TV chooses the n-closest lights and passes them to the shader.

But there isn't a function in TVLightsFactory to get the indexes of those active lights. I asked Sylvain and he told me that you have to iterate through all lights and do a boolean check using IsLightActive() in order to find those indexes.

Say that you get the following indexes after iteration: 2,7,9,11

Now in the shader the LIGHTPOINT0_POSITION is the position of the light with index 2?
The LIGHTPOINT1_POSITION is the position of light 7?

That's what I'm asking.

Edit: I found a workaround but it would still be good to know.
« Last Edit: January 20, 2008, 03:11:32 PM by Leon_ » Logged

Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks