Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Deferred Lighting via Compute Shaders


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
2 replies to this topic

#1 NiteLordz   Members   -  Reputation: 466

Like
0Likes
Like

Posted 13 March 2012 - 10:55 AM

Recently i implemented Deferred Tile lighting via compute shaders. took me a little bit of time, as debugging the compute shaders wasn't fun. BTW, we need a debugging method for that.

on to my questions though. So my compute shader takes a buffer of point lights, and determines which lights are visible for each tile, and then executes the lighting equation. this is standard.

1)if i wanted to add in spot lights, what would be the best approach.

-expand my pointLight structure to house the additional properties needed, and then also add a type member so that the shader knows which lighting and frustum culling method to use?

-create a seperate light buffer just for the spot lights, and add an extra pass via the compute shaders to run thru the spot lights?

2) since i have this nice buffer of lights, is there any way i can utilize it inside of a compute shader to handle shadows?

-i am pretty sure i can't do the shadow calcuation at the same time as the lighting calcuations.... or is there....

-other ideas.

thanks much in advance
Code makes the man

Sponsor:

#2 MJP   Moderators   -  Reputation: 11781

Like
1Likes
Like

Posted 13 March 2012 - 12:42 PM

For #1, the only real way to know is to try both and profile to see which is faster. With compute shaders you can often make a change that makes your shader faster on one GPU, but slower on another.

For #2, you're going to need to render your shadow maps ahead of time. To make it a bit easier on yourself you can use a texture array.

#3 Schrompf   Prime Members   -  Reputation: 954

Like
1Likes
Like

Posted 13 March 2012 - 01:42 PM

As long as you're not dealing with shadows, enhancing your point light structures to cover spot lights would probably the better approach. It's just a few additional math ops, which GPUs are really good at. But as soon as shadows enter the arena, a separate pass would be better, I think. Point lights usually need a cube map or maybe a dual paraboloid maps, but it definitely differs from the plain and simple shadow handling of a spot light. You could reunite the both if you manage to put all shadow information on the same resource type, for example by unfolding your cubemaps manually, but I'm not sure if this gains you anything.
----------
Gonna try that "Indie" stuff I keep hearing about. Let's start with Splatter.




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