Lightmass: multi-bounced sky lighting

This was done by when I was on my internship at Epic this summer. I discussed the basic ideas with him. It is basically the same but with several improvements:

  • With each iteration the num of rays is gradually reduced since the impact of subsequent bounces are decreasing
  • There is a hidden setting in BaseLightmass.ini called bCacheFinalGatherHitPointsForRadiosity which allows to cache and reuse the rays in the first bounce so the following bounces are nearly ‘free’ (1~5s). However this will eat a lot of memory. A LOT. In my test a middle scale scene took 29GB of mem. However, since we can run virtual mem on SSDs, it is still practical. With virtual mem on a SSD, the first bounce of radiosity took ~400s, and all the subsequent bounces took ~500s in total (slowed down by virtual mem). This is still much better than 400s * 10 bounces.
  • My mod also calculates emissive but in a wrong way. This is fixed in the master 4.18 version.

Outside the radiosity solver, there are two interesting things:

  • Now skylight cubemaps are actually imported into Lightmass instead of blurry spherical harmonics, which gives you much better directionality of sky lighting.
  • Swarm agent task distribution is greatly improved so it will be less likely putting several huge (>2K) lightmaps on the same machine.

No multibounce+SH vs master 4.18 (multibounce+cubemap):