Luoshuang's GPULightmass

This looks good and promising!

Looks amazing! The quality of the shadows is much higher and I notice that you don’t seem to get the variations induced by multi-threading. Look forward to trying it out and hope Epic adopts this method officially.

Really impressive results. Detail of indirect shadow is incredible.

That would be awesome if they adopted it officially :smiley:

Looks amazing, any chance for a source version availability? i would love to give it a try with my gtx1080 but i’m using a custom 4.19.1 built from source.

Or maybe i can link you the UE4 build on github if you’d rather not share source. Anyway, would love to use your solution.

Thanks Luoshuang !


You can just use the binary distribution. Assuming you’re not modifying UnrealLightmass, then the only thing you need to add is to modify Engine\Source\Editor\UnrealEd\Private\Lightmass\Lightmass.cpp to include the dependencies required by GPULightmass, build, then copy the files inside the zip except UE4Editor-UnrealEd.dll and the installation is finished:

search for

const TCHAR* RequiredDependencyPaths64]



to the end of the list (don’t forget the comma after tbbmalloc.dll!)

search for

const TCHAR* OptionalDependencyPaths64]



Worked Perfectly, thank you Luoshuang !

Waiting for your screenshots! =)

Great results. Can’t wait see where this is going. Keep up the good work!

Man these shots look already amazing! This is gonna be killer for everyone since usually, people building game environments never got the same lighting fidelity as…lets say archviz people. One big part is of course lightmap resolution, but you cant even bake a game map with static level lighting scale 0.1 and indirect lighting quality 10 in a efficient time frame XD Its okay to wait for 3h for an apartment, but just scale that up with landscape and multiple buildings…its gonna take years to bake XD This will help tremendously with keeping the times in check while boosting the look dramatically! Hype hype! :smiley:


Would you like to run some tests with GPULightmass in your scenes to help me catch bugs? :slight_smile:

Man absolutely! I will probably give it a shot with the Dark Souls Environment Iam working on for the Lighting Academy! Nice ruins exterior with quite a bit of vegetation using volumetric lightmaps for static objects :slight_smile:

Stay tuned! <3


EDIT: Regarding quality scaling options…I cant get into much detail here, but what we have exposed is the ray count and a filtering value. If I want to do a preview bake, I set the value to 1024 rays and fitering 1 so it doesnt look splotchy. Once I am happy, I set the ray count to 500 000 or 1mio depending on the map and filter to 0 and thats then final quality. Preview usually finishes in 3mins…the fully quality bakes can take between 2 and 8h depending on map size and complexity.

The cool thing here is everyone can decide for themselves whats their final quality visually speaking. Also emissive generates more noise…so if you have a lot of emissive lighting you might need to bake with more rays. Exposing it like this would give you unlimited freedom for quality vs. baking times :slight_smile:

I am not into static lighting at all, but just dropping by say that this work is truly awesome @Luoshuang


This is INCREDIBLE!! I’m amazed by the speed!! It’s like 10 times faster than the CPU version!! :smiley: You are amazing!! …first the multi bounce Skylight and now this?! :smiley: I hope this will be the future!! Thank you @Luoshuang!!!

I did some testing yesterday (discovered your post too late! ;))…
This scene had almost 5000 meshes, HDRI Skylight, Directional light, Point lights and emissive too! :wink:
Took 22 minutes (!!!) on a GTX1070 /lightmaps from 64 to 2048/

I had other tests too and run into some errors…
In this scene I run into a “out of memory” error just before the tracing… I had to lower lightmap resolutions… What is the memory limit?
I had a scene lit by a HDRI. The result was VERY nice (detailed shadows) but I had white spots close to corners (will post screenshots in a few hours…) …maybe too few samples?
…and there was another one which turned out completely black… but I will check that again!
Oh I did another test this morning with an older lighting test scene from the forum and I got some strange results (will post later, didn’t have time this morning)… I had some lighting appearing which I couldn’t “trace back”… was not looking real…



ps.: What kind of scene/lighting tests would help you @Luoshuang?

/edit/ I forgot to mention the progress bar! It’s so much better than the original (non existing? ;)) one!! …and even has an ETA!! So cool!! :))

It should support OpenCL by then and then it could be good for integration officially. I just now discovered this thread and wanted to try it but found out it is CUDA only.

Thank you! This is looking amazing! Looking forward to see more stuff!

I have another question, would supporting normal maps for GPU Lightmass make sense? would it use too much GPU memory?

Currently the reason why the number of rays is fixed is also tied to some algorithm details - but i’ll definitely make it changeable in the future!

The amount of video memory used is dependent on total number of tris and total number of lightmap texels (i.e. the square sum of lightmap resolution), so it is hard to estimate without seeing those data. However we may still have some hope - did you use the command line baking technique I’ve mentioned in the tips? It can usually save 1.5G~2G vmem since the editor is not rendering.

For the splotches problem, it is very similar to the situation in vray where you have a low subdiv in Light Cache settings and have Retrace set to off. This problem will be fixed next time I change the algorithm.

For the light leaking problem, Norman3D have already noticed it in some tests done with me. If you can also provide some simple scene reproducing the bug the it would be very helpful! :slight_smile:

GPULightmass bakes directional lightmaps which should support normal maps by natural. But if you want the bounce calculation to take them into account or let the result be baked directly into lightmaps then it is not supported, and I probably won’t support that since it has been proved to cause many problems unless you are targeting low-end platforms like mobile where directional lightmaps are not supported by the UE runtime.

Currently all platforms support directional lightsmaps. Haven’t seen any case where using normal maps for light bake calculating would result anything but problems.

Still, I don’t quite understand what is the use case for using normal maps in baking :confused: