Lightmass: multi-bounced sky lighting

Also make sure you kill thr launcher. It takes up some cpu resources. I noticed the editor was only at 30% cpu usage due to the laumcher eating close to 40% doing some shady stuff. Maybe selling drugs? Lol. I killed it and now the editor is at 90 to 94% constant. Makes a huge difference.

Just on this - I’m a moron and had my skylight set to stationary.

Works beautifully

I also was under the impression the new 4.17 takes a lot longer but I tested it with a project in both 4.16 and 4.17. The calculation time was almost equal (about 2h for both). Puzzled…

I just found this awesome thread and tried this custom lightmass.exe. But am I missing something? There seems to be no differ in final render with this custom one. I have a static skylight which is capturing a sphere with hdri map. (also tried with that BP_Sky_Sphere) No matter how much indirect bounces I put, it’s still as dark as with 1 bounce.

I’m new to Unreal and I just found this nice looking custom lightmass.exe. I just tried this, but I really can’t make it work. I have a static skylight which is capturing a sphere with hdr map in it but the final render seems to be as dark with 100 bounces as with one indirect bounce. I also tried with BP_Sky_Sphere.

I just want to let you know **Luoshuang, that your work is awesome, **thank you so much for sharing it with the rest of the world and making it easy for us mortals to get great lighting.

Can’t wait for 4.17 version. Keep up the good work!

A link to 4.17 version is on page 13 of this thread.

Thank you so much! I will try it!

4.17 update?

Sorry, just saw link to it. Thanks again.

Hi, I’m pretty new to Unreal and don’t yet know lightmass settings etc. fluently… Where is the setting in the new modded lightmass rollout that controls the number of bounces?


Are there plans to incorporate this in the main UE4 code ?

First off I just want to say that this is simply awesome! Unfortunately this isn’t working for me for some reason. I downloaded the 4.17 UnrealLightmass.exe and did some tests of my own. I’ve used both Skylight and Directional lights, and both static and stationary lighting, and tried bounce values between 1 and 50. The extra bounces certainly increase render time haha, but don’t have any visual effect on the scene. It might be worth noting that I haven’t tried this with any of the other previous versions, I’m brand new to this mod :slight_smile:

From reading the comments it sounds like it’s working for some and not for others… not sure what’s up :confused:

Coming in 4.18:

Change 3618408 by Daniel.Wright
Lightmass skylight solver improvements

  • Lightmass uses a filtered cubemap to represent the skylight instead of a 3rd order Spherical Harmonic. Directionality in shadowed areas is improved. Mip level is chosen based on the ray differential for anti-aliasing.
  • Multiple skylight and emissive bounces are now supported with a radiosity solver, controlled by NumSkyLightingBounces in Lightmass WorldSettings. More bounces results in longer build times, and the radiosity time is not distributable.
  • The mapping surface cache is now rasterized with supersampling, reduces incorrect darkness in corners
  • Combined direct lighting, photon irradiance, skylight radiosity and diffuse in the mapping surface cache so final gather rays only have to do one memory fetch, speeds up lighting builds by 7%.
  • Added support for Embree packet tracing although no solver algorithms use it yet

Change 3618413 by Daniel.Wright
Swarm hands out the most expensive tasks in roughly a round robin ordering among distribution agents. Lightmass processing of a single task is multithreaded, so ideally the most expensive tasks are evenly distributed among active agents. This has the biggest impact in small scenes with 10’s of high resolution lightmaps, and with a distribution farm. Build time in one scene went from to 113s -> 47s.

will be very interesting to see how this one compares to Luoshuang’s solution !

This was done by Daniel 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):

@**Luoshuang **

Are you saying that 4.18 will have multi-bounced skylight with all these improvements out of the box ?

I hope this will be documented somewhere, otherwise it will get lost in time like so many other hidden options and cvars.

Yes, it’s already integrated in GitHub master branch.


What about this bug that you reported to Daniel?…r-spot-lights=

@**Luoshuang **Thanks for the explanation / comments. Hoping for a quick release of 4.18 preview…

How do you get shadows with the Skylight?