Sign in to follow this  
Max_Payne

Fast Global Illumination

Recommended Posts

Max_Payne    757
Even when implementing photon mapping, I never got any really good performance. It took my renderer several hours to get some decent illumination in a simple cornell box. Not so long ago, I saw a shot of VRay, which apparently using photon mapping, rendered a 640x480 variation of a cornell box with two lights in 2 minutes 30 seconds, with antialiasing and no noise at all. My question is: how do they do it? Is there some publically available information about the functioning of VRay. They must have some very clever optimization tricks to get that kind of performance. Does anyone know optimization tricks to speed up photon mapping that much without losing any quality?

Share this post


Link to post
Share on other sites
timw    598
wow, no offense, but thats a terrible render time lol. Photon mapping is best used in conjunction with path tracing, it takes to many photons to converge if you're only using photon mapping. photonmapping is the second order estimate for the path tracing algorithm that is, after you path trace one diffues bounce, you use the photon map instead.

usually it's combined with irradiance cacheing. which really helps performance. also you can evaluate direct lighting analitically sometimes. so that helps too.
very important is stratification. VERY important.


it's next to impossible to use photon mapping alone, to get resutls that are chrisp. it just takes to many photons, what exactly are you doing?

Tim

Share this post


Link to post
Share on other sites
There could really be a hundred reasons why your renderer is so slow. A simple cornell box should not take nearly that long to render!

As far as I know, VRay uses something it calls a "lightmap" which sounds to me a lot like path tracing with irradiance caching.

As timw says, you really want to use photon mapping for doing the first few bounces from the light, then use path tracing or final gathering (probably with irradiance caching) to compute the radiance estimate from the camera.

Share this post


Link to post
Share on other sites
ApochPiQ    23003
All of rendering is a series of trade-offs. Performance for quality, speed for physical accuracy.

There are, however, some evil tricks you can do.


As has been said, vanilla photon mapping is not an efficient illumination model. Direct visualization is not a good approach. You want to try and wring out every single possible ounce of speed, and that means taking advantage of the 10 years of development in photon mapping-related techniques.

- Use a fast Whitted tracer to do your direct illumination. Don't even store direct illumination data in the photon map. This makes the map smaller (and therefore faster to traverse) as well as eliminates potential error from double contributions.

- Use final gathering to speed up the indirect contribution calculations. There's a billion and four papers on this (and variant techniques) available on the Web.

- Perform an irradiance caching pass before visualization. Actually, there's a whole family of operations that can be done here - play around a bit, and be creative. One really cool thing you can do is downsample the photon map, and essentially distribute the same flux over a smaller number of photons. The pruning method depends on how well your filtering/gathering works, so it can take some time to get perfected. The other problem is that, for efficiency, you basically have to construct a second photon map with the downsampled data. The second map can be on a regular grid if you don't mind some aliasing artifacts in your illumination, although an irregular kd-tree is more effective in my experience.


In general, exploit coherency as much as possible. Find ways to compute lots of data in a small volume of space, and reuse it as many times as you can before moving on. There's some stunts you can pull here; variations on importance mapping, subsampling/progressive refinement, etc. are all worth investigating.


On modern hardware a Cornell box should be easy to render at that resolution in around 2 minutes with good visual quality. If you're sneaky and willing to sacrifice a tiny bit of visual accuracy, you should be able to render it in 30-45 seconds.

Sometime I'll have to dig the Freon architecture back out and see what my Athlon64 3200+ is capable of [smile]

Share this post


Link to post
Share on other sites

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