Announcement

Collapse
No announcement yet.

Luoshuang's GPULightmass

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • started a topic Luoshuang's GPULightmass

    Luoshuang's GPULightmass

    Click image for larger version  Name:	image_138398.jpg Views:	1 Size:	82.0 KB ID:	1478783

    Disclaimer:

    This is a very simple and early version of my GPU lightmap baker. Don't expect much from it! =)

    Binary Installation:

    4.19.1: https://www.dropbox.com/sh/3issyqm20...f6eEbmKRa?dl=0 [Updated 04/16/2018 18:13]
    4.19.2: https://www.dropbox.com/sh/nkte4fotk...m6dBe-i_a?dl=0
    4.20.1: https://dl.orangedox.com/gjD37r7TcxMV4jqx9U (starting from here it requires NVIDIA driver version >= 398.26)
    4.20.2: https://dl.orangedox.com/P02pizph3hSVF1OtSJ
    4.20.2 Unified Settings: https://dl.orangedox.com/lUSb6PnfVOoyAFcDz3 (see #478 for instructions on how to use)
    4.21.0 Unified Settings: https://dl.orangedox.com/YtozAlX0QCNN57KXT2 (Turing cards support, requring driver >= 411.31, not using RTX)
    4.22.0 Unified Settings: https://dl.orangedox.com/93ekBf83FHfyK0zZbp (FireflyClampingThreshold has been loosened to allow more contrast from skylight and correct brightness for emissives - if you start to see fireflies from sky or emissive you may want to set it to lower values like 10.0 (in BaseLightmass.ini))

    Merge the zip's content with your UE_4.19/Engine folder.
    This installation overwrites your BaseLightmass.ini so you want to back it up if you have modified its parameters.
    • If you want to keep your BaseLightmass.ini, set bUsePhotonMapping and bUseRadiositySolverForSkylightMultibounce to false to avoid CPU computation.
    Sorry for no 4.18 support, since some logic dealing with volumetric lightmaps changes a little bit too much in 4.19.

    Automatic Script Installer:

    Situx has done a nice installer for GPULightmass that checks multiple things to help prevent problems:
    https://forums.unrealengine.com/deve...11#post1519111

    Source (Hybrid) Installation:

    For versions prior to 4.20.2 unified settings, see https://forums.unrealengine.com/deve...65#post1460865
    For 4.20.2 unified settings, see https://forums.unrealengine.com/deve...66#post1529966
    For 4.21.0 unified settings, refer to 4.20.2 but use this one: EngineModification4.21.0.zip

    Limitations:
    • Written in CUDA so NVIDIA only.
    • Supports all 4 standard lights (point, spot, directional and sky)
      • However stationary skylight is not supported so if you have one in your scene it will still be baked since it is treated as a static one
      • Advanced lighting features such as soft shadows (SourceLength and SourceRadius) and IES are not respected when calculating indirect lighting. However you may still see some effect of them since their direct lighting is calculated on CPU
        • According to some tests the direct lighting is low quality sometimes because Lightmass quality level is set to "Preview". While this problem is actually irrelevant to GPULightmass, you'll probably want to set the quality level to "Production" to avoid such kind of mysterious problems.
    • Supports baking of standard surface lightmaps, volumetric lightmaps (also with faster voxelization), and sparse volume lighting samples
    • Lightmass parameters and quality settings specified in the editor are ignored except for Num Indirect Lighting Bounces
      • Current the number of samples (quality settings) is hardcoded in the program and you cannot change it since I haven't found an reliable way to expose them to the user
      • AO Mask generation is not supported
    • GPULightmass should work with Swarm distributed rendering naturally as long as you've correctly set up the environments on all machines. (esp. a sufficiently new NVIDIA driver)

    Useful Tips:
    • GPULightmass uses Brute Force as its Primary GI Engine and some form of radiosity caching as its Secondary GI Engine, which is very similar to vray.
      • Brute force is much more accurate than Irradiance Caching (Lightmass's primary GI engine) but it is also slower. It is also more sensitive to lightmap resolution since it actually calculates each lightmap texel, while irradiance caching is more or less resolution independent. You may want to tune down your lightmap resolutions firstly then slowly tune them up when working with GPULightmass.
      • Comparison of Brute Force vs Irradiance Caching:
      • Click image for larger version  Name:	V1.jpg Views:	1 Size:	121.6 KB ID:	1460558
      • Since adaptively placing more samples around corners (known as Retrace in vray) hasn't been implemented you may see sploches.
    • You can use command line to launch the editor and bake lighting to save GPU resources for GPULightmass, especially video memory.
      • Engine/Binaries/Win64/UE4Editor-Cmd.exe "path\to\your\project\yourproject.uproject" -run=resavepackages -buildlighting -allowcommandletrendering -map=/Game/Maps/MyMap.umap
      • Remember to replace Content with Game in the umap path
    • It is recommended to change Windows TDR settings to prevent the GPU from being timed out (unspecified launch failure and other Error crashes) under heavy workload
    • Some stats:
      • A scene having 30M triangles and 150 1K lightmaps requires 7GB video memory and ~3hrs to bake on a GTX1080
    Change Log:

    [04/16/2018] Fixed attenuation calculation of spotlights
    [04/14/2018] Further improved the adaptive hemisphere sampler to suppress visible artifacts
    [04/14/2018] Fixed issues with sparse volume lighting samples and masked materials
    [04/14/2018] Fixed a bug inside the adaptive hemisphere sampler. The number of samples is also raised. Now GPULightmass runs at Ultra High settings by default, which is a little bit overkill for most scenes.
    [04/13/2018] Added support for sparse volume lighting samples
    [04/13/2018] Fixed a bug which prevents GPULightmass from running on cards that are older than GTX10XX

    Known Issues:
    • Ray hit rejection by LOD/HLOD hasn't been implemented and you may see black splotches where lower LOD meshes poke out.
    How to Get the Best out of GPULightmass:
    • Currently GPULightmass uses all emissive materials in baking regardless of 'Use Emissive in Static Lighting' option. If you see sparkles they are probably from some small bright emissive sources (especially, small LED panels in kitchen). You'll want to use the LightmassReplace material node or set the EmissiveBoost to zero to remove them for GPULightmass. Starting from 4.20 GPULightmass respects 'Use Emissive in Static Lighting' option. However, the idea is to not use any small & bright emissive light sources in GPULightmass. If you want to get rid of sparkles, you can also try tuning down 'FireflyClampingThreshold'.
    • GPULightmass uses 'Two Sided Emulation' on all two-sided materials which could be the reason why people are seeing darken environments and light leaks. Currently the workaround is to turn off two-sided on the problematic materials. See https://forums.unrealengine.com/deve...32#post1477832
    Attached Files
    Last edited by Luoshuang; 04-04-2019, 06:30 PM.

  • replied


    This is a scene of blender 3D. I converted the whole scene for Realtime experience in unreal engine.

    Download the free Demo EXE of this project from my site https://3darchstuffs.com/.

    Visit https://3darchstuffs.com/ for more unreal arch-viz tutorials, Demo EXE and Unreal projects
    Last edited by 3darchstuffs; 09-19-2019, 02:21 AM.

    Leave a comment:


  • replied
    Originally posted by scha View Post

    Thanks. I used 128,64,1000 and it was pretty fast. I didn't notice any splotches, but the shadows look more "hard" with the GPU version.
    For example, there are the same view baked with CPU and with GPU. I like more how the shadows look in the CPU version.

    Is there some parameter to make GPU shadows more soft?


    sorry, no idea...did you use Num Indirect Lighting bounces = 100 ??
    or maybe changing the HDRI if you are using one, I would not expect same results in two different ways of calculating light...just talking for the experience with vray cpu and gpu that have also a lot of differences...but it is just a guess
    Last edited by Idgi_; 09-18-2019, 12:08 PM.

    Leave a comment:


  • replied
    Originally posted by Idgi_ View Post

    with the "extreme settings" that I am working, on the ini says:
    NumPrimaryGISamples=128
    NumSecondaryGISamples=32

    I have also changed the fireflyclamp to 10, the only number that gives me no bright splotches
    Thanks. I used 128,64,1000 and it was pretty fast. I didn't notice any splotches, but the shadows look more "hard" with the GPU version.
    For example, there are the same view baked with CPU and with GPU. I like more how the shadows look in the CPU version.

    Is there some parameter to make GPU shadows more soft?


    Click image for larger version  Name:	InkedScreenShot00002_LI.jpg Views:	2 Size:	488.7 KB ID:	1666113
    GPU Lightmass

    Click image for larger version  Name:	InkedScreenShot00000_LI.jpg Views:	2 Size:	478.8 KB ID:	1666114
    CPU Lightmass

    Leave a comment:


  • replied
    Originally posted by scha View Post

    No I just copied the files. I tried using NumPrimaryGISamples=256, but I think it's a little bit over the top, took like 25 min. Now trying 128, seems it will take about 5 mins only.

    edit: yep, seems 128 is the right number And it looks good! but it looks slightly different than the normal lightmass, like less smooth.
    with the "extreme settings" that I am working, on the ini says:
    NumPrimaryGISamples=128
    NumSecondaryGISamples=32

    I have also changed the fireflyclamp to 10, the only number that gives me no bright splotches

    Leave a comment:


  • replied
    Originally posted by Idgi_ View Post

    I am not an expert, but did you use the script to install?
    If you did, there you can find the "lightmassconfiguration.bat" where you can change quality settings

    the only thing that does not ignore is: "Lightmass parameters and quality settings specified in the editor are ignored except for Num Indirect Lighting Bounces" ... quoted from https://forums.unrealengine.com/deve...ss#post1460002
    No I just copied the files. I tried using NumPrimaryGISamples=256, but I think it's a little bit over the top, took like 25 min. Now trying 128, seems it will take about 5 mins only.

    edit: yep, seems 128 is the right number And it looks good! but it looks slightly different than the normal lightmass, like less smooth.
    Last edited by scha; 09-17-2019, 04:54 PM.

    Leave a comment:


  • replied
    Originally posted by scha View Post
    Hi there, quick question. Where do you modify quality settings? I understood that it ignores the settings in the editor UI. Is modifying NumPrimaryGISamples and NumSecondaryGISamples in the ini enough?
    I am not an expert, but did you use the script to install?
    If you did, there you can find the "lightmassconfiguration.bat" where you can change quality settings

    the only thing that does not ignore is: "Lightmass parameters and quality settings specified in the editor are ignored except for Num Indirect Lighting Bounces" ... quoted from https://forums.unrealengine.com/deve...ss#post1460002

    Leave a comment:


  • replied
    Originally posted by Nocturness View Post
    hi guys i have huge problem with 4.23.0 gpulightmass on yesterday. (binary version)

    BUILD SUCCESSFUL for win64 but when i run the package exe i get this message. i did check RHI settings and setted dx12. (raytace activated project)

    https://i.ibb.co/Mpmy0cZ/packerrror.jpg

    Engine version verified and problem gone. A really big problem on gpu lightmass with 4.23.0 (even packaging successful but not working). please alert users/developers to this problem.
    I have just updated the binaries after Yujiang identified the problem.
    Packaging should now be working correctly.
    You would need to download the updated binaries from the same link as before, and apply them.
    Let me know if the problem is still present after updating. Otherwise, send thanks to Yujiang!
    Last edited by pax invictus; 09-17-2019, 04:33 PM.

    Leave a comment:


  • replied
    Originally posted by RVillani View Post

    When that happened to me I figured later it was a driver issue (there's also something bout it on this thread). NVidia drivers will prioritize any 3D work over CUDA processing. So minimize Unreal while building, if your browser uses hardware acceleration minimize it too or turn that off and, in my case, I have to close Wallpaper Engine too. Anything that might be using the GPU for graphics processing, shut it down or minimize it. I saw an instant speed difference after closing/minimizing those while GPU Lightmass does its thing.
    Yes, already noticed that, and these last builds the browser was closed and the Unreal editor minimized...so there was nothing going on in my computer appart from the build light..the funny thing is that the ventilator of the GPU is almost not working when baking that level, wich means the calculation goes slower as normal during those bake lights...but if I bake anything other, like the same level with just a part of the whole project, the ventilator is working full and the velocity of bake is back to normal, also in the build statics when it goes slower it says "overall xxx seconds 10.72Mrays/s" and in other cases can go up to 277,76 or 340,22 Mrays/s, so I guess that is something more objective than the ventilator ...not sure why all this happen

    EDIT: after 7hours of waiting, only got 10% done at an "overall 22332.44s 16.33Mrays/s" and still 47h to go, but it looks like the most it does the slower it gets.... the GPU is almost not working, resource monitor says it is at 5% (CUDA 0-100%)...the Memory at 60% and the CPU at 21%
    It looks like performance is down and I do not know why...ANY HELP?
    Last edited by Idgi_; 09-18-2019, 04:47 AM.

    Leave a comment:


  • replied
    Hi there, quick question. Where do you modify quality settings? I understood that it ignores the settings in the editor UI. Is modifying NumPrimaryGISamples and NumSecondaryGISamples in the ini enough?

    Leave a comment:


  • replied
    Originally posted by Idgi_ View Post
    hello,

    I am working in a project for this last months in ue 4.22...till now it was everything perfect, but since I am trying to do the last lightmass build I am having some problems...the configuration is the same as in previous builds, I am working with the "Extreme settings" and the problem is that suddenly, the build times increased a lot...the same scenen that it took almost 6 hours, now is taking 2 days...as I said, nothing new in the scene, exactly the same...any ideas? thank you very much!
    When that happened to me I figured later it was a driver issue (there's also something bout it on this thread). NVidia drivers will prioritize any 3D work over CUDA processing. So minimize Unreal while building, if your browser uses hardware acceleration minimize it too or turn that off and, in my case, I have to close Wallpaper Engine too. Anything that might be using the GPU for graphics processing, shut it down or minimize it. I saw an instant speed difference after closing/minimizing those while GPU Lightmass does its thing.

    Leave a comment:


  • replied
    hello,

    I am working in a project for this last months in ue 4.22...till now it was everything perfect, but since I am trying to do the last lightmass build I am having some problems...the configuration is the same as in previous builds, I am working with the "Extreme settings" and the problem is that suddenly, the build times increased a lot...the same scenen that it took almost 6 hours, now is taking 2 days...as I said, nothing new in the scene, exactly the same...any ideas? thank you very much!

    Leave a comment:


  • replied
    Ah, thanks RVillani

    Came to the party quite late so thanks for the update.

    Leave a comment:


  • replied
    KM3d300 It's not on development anymore. Luoshuang was hired by Epic and is now working on a GPU Lightmass version for the engine. He was starting a new version of it already with support for new stuff and improved lightmapping, specially on UV seams. So I believe that'll all be included in the Engine. But how long from now? No idea.

    Leave a comment:


  • replied
    This is so good - the results are consistently gorgeous and so much better than "irradiance mapping".

    I know it's been asked before, back in 2018 - but are IES and area lights on the roadmap for support?

    Leave a comment:

Working...
X