Jump to content
  • Advertisement
Sign in to follow this  
3DModelerMan

Realtime instant radiosity

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

Hi, I'm going to try and write a realtime radiosity lighting system for my game engine. I've googled realtime radiosity and come up with a few algorithms. The one I find most though is instant radiosity. I'm going to implement it for my radiosity, but I had a few questions about how to actually do it.

Where should the first ray trace be done? Should it be done on the CPU? Raycasts on the CPU are pretty expensive aren't they? What I was thinking, but can't figure out how it would be done: is to do the raycasts on the GPU with a depth map rendered from the light (like with shadow mapping). But then I would have to create the Virtual Point Lights (VPLs). Wouldn't their positions have to be stored in system memory and passed into the next shader? And finally, are each of the VPLs shadow mapped? That seems like it would take a whole lot of processing power.

Share this post


Link to post
Share on other sites
Advertisement
Where should the first ray trace be done? Should it be done on the CPU? Raycasts on the CPU are pretty expensive aren't they? What I was thinking, but can't figure out how it would be done: is to do the raycasts on the GPU with a depth map rendered from the light (like with shadow mapping).
Yes, rasterising from the light's point of view is the same as performing a whole batch of ray-casts from the light's point of view. This is a good approach.
But then I would have to create the Virtual Point Lights (VPLs). Wouldn't their positions have to be stored in system memory and passed into the next shader?[/quote]The VPL's vertex shader can read the depth values from the previous pass and use those values to reconstruct the positions of each ray-cast "hit".
And finally, are each of the VPLs shadow mapped? That seems like it would take a whole lot of processing power.[/quote]Not in the implementations I've seen.

Share this post


Link to post
Share on other sites
So don't cast any shadows from the VPLs then? And basically you just render from the light's point of view, trace the lines, calculate the VPL positions in a vertex shader, then the lighting from each VPL, and project the results onto the model that's being lit? Or do you project the depth map onto the model and work from there tracing the lines?

Share this post


Link to post
Share on other sites
What do you mean by 'trace the lines'?

All the implementations I've seen have been in combination with deferred shading (because it's a good way to support large numbers of dynamic lights, which is what the VPLs are).

When you render from the light's point of view, you generate a depth buffer (which is equivalent to a position buffer), a normal buffer, and a colour buffer that holds the amount/colour of the light reflected off that point.

Then, you render you VPLs just as you would any deferred light source, except that each VPL is associated with a different pixel in your light's buffers. In the VPL's vertex shader, you fetch the above data from that VPL's pixel (i.e. read the depth to translate your light to the right place, read the normal so you know what direction the light is being emitted in, and read the colour so you know the intensity/colour of the light).

Share this post


Link to post
Share on other sites
There are some VPL implementations that do shadow-mapping for the VPLs, as well. Check out Imperfect Shadow Maps (http://www.mpi-inf.mpg.de/resources/ImperfectShadowMaps/). They use very small/imprecise/coarse shadow maps to make the approach more computationally feasible. I'm still not convinced it's a good way to spend your GPU cycles (or that anyone has ever implemented it in a production environment), but it might be worth looking at.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!