Jump to content

  • Log In with Google      Sign In   
  • Create Account


How do you deal with spotlights when you're done with the point lights?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 mrheisenberg   Members   -  Reputation: 356

Like
0Likes
Like

Posted 11 November 2012 - 12:33 PM

I managed to cull point lights in the compute shader,which is easy,since it's just a center and radius and then accumulate their effect on the surfaces,how should one go after that to implement spotlights?My confusion is in 2 parts:1.are the spotlights accumulated on a seperate pass(run a different version of the compute shader after the one for the point lights) or can I do them all at once,for instance having my Light struct have a lightType and check it's type in the compute shader and branch to the appropriate calculations(that would hurt parallelism I think).And 2 - should I cull them at all?I mean it might not be in the view frustum,but even if it's 10 meters behind you,it can still point at your directiont and have a visible effect inside the frustum.

Sponsor:

#2 kauna   Crossbones+   -  Reputation: 2336

Like
0Likes
Like

Posted 11 November 2012 - 12:47 PM

There are plenty of ways to handle spot lights.

- you may well draw them after your point lights in a separate pass or somehow integrate them so that your compute shader is able to handle them both.

- If you place your lights in a sorted array (the points lights are first and then followed by the spot lights), you may avoid branching a bit since you may just loop over the amount of each light type.

- For easy starter, math wise you may use your point light algorithm to draw spot lights, only thing you'll need to add is the required spot light direction and the inner and outer cone variables. Of course this way there is lots of unnecessary pixels processed.

- Even a point light can be behind you and have a radius of some hundred of meters. Culling spot lights exactly may be just a bit more demanding.

Cheers!

Edited by kauna, 12 November 2012 - 07:01 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS