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
    @Luoshuang
    Hi,
    I use GPU calculations to light scenarios levels.
    I have found a problem when calculating.
    lets say "night" level after successful build lightmap calculation, other level "day" got mostly lights and some objects already calculated turn back to "need to be rebuild".
    I migrated main level and his light scenarios to clean project, did try clean new light levels and problem persist.
    I don't have any new idea how to solve it, can it be that it is a bug?
    I would appreciate a lot your help. I'm stack with my project.
    Thanks


    Attached Files

    Leave a comment:


  • replied
    Why the SWARM does not work anymore?
    I have connection. All hosts are seeing each other and the Coordinator.
    But the task is not distributed to the networked hosts even if AvoidLocalExecution is TRUE ( then the main host still baking the Lightmaps even if it should not ).

    Anybody knows what's happen ?

    Fixed: ESET Firewall Problem. SWARM works.
    Last edited by Muchasty; 05-23-2019, 02:33 PM.

    Leave a comment:


  • replied
    I should start by saying a big thank you to Luoshuang for the amazing work on this project. I'm using a 2080ti and it reduces my build times to about a fifth of that on CPU, I couldn't believe it first time.

    However, my main stumbling block is that I'm using a single skylight as the only pre-rendered light source in my game. This light is set to Stationary which meant, when I was using CPU-lightmass, this light's intensity could be reduced over time via a blueprint and its baked lightmaps in the world would be reduced along with it. This was how my day/night cycle was working (there was only ever one general lighting condition during the day).

    However, with GPU Lightmass, this light (I'm assuming) gets converted to a static light (as stated in the description) and so the lightmaps stay at a fixed intensity, even when the light is turned down via blueprint. In other words the whole map looks illuminated at night (even when all lights are off).

    I know, for now, this is a hard limit of the GPU Lightmass method but is there any news on current / future development to remedy this?

    I would be eternally grateful for a solution to this problem. Thanks!

    Leave a comment:


  • replied
    Hi Everyone,

    my first comment here, just love this GPU lightmass project.

    I'm busy with my first project and I'm very impressed with quality. I am however now starting to get this error on lightmass calculation below, can anyone please help me decode what the problem is?

    The failure happens just before the GPU lightmass calcs start, so before the progress bar pops up. CPU, RAM and GPU memory seems fine (I have two GPUs, 1070ti on two monitors and 1080ti for rendering) and I have cleared the cache

    Much appreciated.

    <None> === Lightmass crashed: ===
    Assertion failed: (Index >= 0) & (Index < ArrayNum) [File:c:\ue4-gpulightmassintegration\engine\source\runtime\core\public\Containers/Array.h] [Line: 611]
    Array index out of bounds: 9745770 from an array of size 9745770


    0x00007ffc09918e6c KERNELBASE.dll!UnknownFunction []
    0x00007ffb31aded47 UnrealLightmass-Core.dll!UnknownFunction []
    0x00007ffb31ae16d7 UnrealLightmass-Core.dll!UnknownFunction []
    0x00007ffb3197234a UnrealLightmass-Core.dll!UnknownFunction []
    0x00007ffb318fd699 UnrealLightmass-Core.dll!UnknownFunction []
    0x00007ffb318fdde9 UnrealLightmass-Core.dll!UnknownFunction []
    0x00007ff76b026528 UnrealLightmass.exe!UnknownFunction []
    0x00007ff76afa8b70 UnrealLightmass.exe!UnknownFunction []
    0x00007ff76afa905a UnrealLightmass.exe!UnknownFunction []
    0x00007ff76afa905a UnrealLightmass.exe!UnknownFunction []
    0x00007ff76af6b39b UnrealLightmass.exe!UnknownFunction []
    0x00007ff76af9374a UnrealLightmass.exe!UnknownFunction []
    0x00007ff76afb6dd9 UnrealLightmass.exe!UnknownFunction []
    0x00007ff76af6bb64 UnrealLightmass.exe!UnknownFunction []
    0x00007ff76af8f36d UnrealLightmass.exe!UnknownFunction []
    0x00007ff76afae4da UnrealLightmass.exe!UnknownFunction []
    0x00007ff76b021bb8 UnrealLightmass.exe!UnknownFunction []
    0x00007ffc0a1313d2 KERNEL32.DLL!UnknownFunction []
    0x00007ffc0c6454f4 ntdll.dll!UnknownFunction []

    Leave a comment:


  • replied
    Originally posted by dustintinkler View Post

    Still having this error, here are some more images. i tried migrating the level to a fresh project and it fixed some but introduced others. I also tried using cpu lightmass and im getting similar unpredictable errors.
    I am at a loss, I dont understand why all of a sudden these meshes started acting like this and I just cant figure out a fix or why its happening.

    Click image for larger version Name:	HighresScreenshot00055.jpg Views:	1 Size:	197.5 KB ID:	1622740Click image for larger version Name:	HighresScreenshot00056.jpg Views:	1 Size:	221.0 KB ID:	1622741Click image for larger version Name:	HighresScreenshot00054.jpg Views:	1 Size:	139.1 KB ID:	1622742Click image for larger version Name:	HighresScreenshot00053.jpg Views:	1 Size:	171.8 KB ID:	1622743
    are you using double face materials? this causes problems.

    Leave a comment:


  • replied
    [QUOTE="dustintinkler;n1622739"]

    Still having this error, here are some more images. i tried migrating the level to a fresh project and it fixed some but introduced others. I also tried using cpu lightmass and im getting similar unpredictable errors.
    I am at a loss, I dont understand why all of a sudden these meshes started acting like this and I just cant figure out a fix or why its happening.


    I recommend you reimport the mesh and see if it fixes it. Depending on which UE4 (4.20 I think) version, there is a nasty bug where you have a import the new mesh with a different name or delete the old Uasset together before it refreshes correctly.

    There are other oddities with static mesh imports sometimes...

    Leave a comment:


  • replied
    Originally posted by timob View Post
    Is there a way to use more than 1 local gpu? Can I run an example using four gtx1070 at the same time?
    Multiple GPU on one machine is not supported. You can setup four different machines and use Swarm. That works.

    You can use lower spec power computers and pop the 1070s in there.

    Leave a comment:


  • replied
    Is there a way to use more than 1 local gpu? Can I run an example using four gtx1070 at the same time?

    Leave a comment:


  • replied
    Originally posted by dustintinkler View Post
    I have been getting a strange bug where certain faces usually facing in one direction in both positive and negative render completely back. all of a sudden it started happening on meshes I haven't touched or changed anything on. I have tried what seems like everything, I have re uv'd, changed lightmap res, and countless other things. in one section i have had luck with just simply exporting and re importing while changing nothing and it has fixed the issue. In other areas that fix dosent seem to work. Ill post some images in lit, unlit, and lighitng only.
    Its the horizontal beam above the ceiling.

    Thanks in advanced,

    Click image for larger version  Name:	HighresScreenshot00053.jpg Views:	1 Size:	120.7 KB ID:	1618933Click image for larger version  Name:	HighresScreenshot00054.jpg Views:	1 Size:	113.4 KB ID:	1618934
    Still having this error, here are some more images. i tried migrating the level to a fresh project and it fixed some but introduced others. I also tried using cpu lightmass and im getting similar unpredictable errors.
    I am at a loss, I dont understand why all of a sudden these meshes started acting like this and I just cant figure out a fix or why its happening.

    Click image for larger version  Name:	HighresScreenshot00055.jpg Views:	1 Size:	197.5 KB ID:	1622740Click image for larger version  Name:	HighresScreenshot00056.jpg Views:	1 Size:	221.0 KB ID:	1622741Click image for larger version  Name:	HighresScreenshot00054.jpg Views:	1 Size:	139.1 KB ID:	1622742Click image for larger version  Name:	HighresScreenshot00053.jpg Views:	1 Size:	171.8 KB ID:	1622743

    Leave a comment:


  • replied
    Originally posted by ldo View Post
    Did anybody have the opportunity to test 2080 ti or maybe 1080ti vs 2080ti in GPU Lightmass?
    2080TI it work smooth in 4.22

    Leave a comment:


  • replied
    Originally posted by Hawks_architect View Post


    Hi all. In the same way as many other UE4 users, I have found this tool a bit late. Unfortunately I am following the steps that Luoshuang poses, but I can not install the GPULightmass engine from the source. The version I have of UE4 is 4.22.1, it jumps an error that says: "GPULightmasKernel.dll is missing. Some of you can tell me the steps to perform the correct installation. I am not a video game programmer, I am an architect in love with the tool that UE4 gives me.
    Well, you'll need to know how to compile the engine from source if you are using this version to install. Have you built the engine successfully from Source code using Visual Studio 2017? Make sure when you're building, you follow instructions on what to edit along with SceneExport.h here: https://forums.unrealengine.com/deve...ightmass/page3

    I'd advise using the Binary version instead of Source. Are you modifying the engine source code? It's usually not necessary unless you're doing a lot of engine code edits. I presume you're not since you said you're not a game programmer. Stick with Binary and use Situx's script.

    Leave a comment:


  • replied
    I have been getting a strange bug where certain faces usually facing in one direction in both positive and negative render completely back. all of a sudden it started happening on meshes I haven't touched or changed anything on. I have tried what seems like everything, I have re uv'd, changed lightmap res, and countless other things. in one section i have had luck with just simply exporting and re importing while changing nothing and it has fixed the issue. In other areas that fix dosent seem to work. Ill post some images in lit, unlit, and lighitng only.
    Its the horizontal beam above the ceiling.

    Thanks in advanced,

    Click image for larger version

Name:	HighresScreenshot00053.jpg
Views:	1
Size:	120.7 KB
ID:	1618933Click image for larger version

Name:	HighresScreenshot00054.jpg
Views:	1
Size:	113.4 KB
ID:	1618934
    Last edited by dustintinkler; 05-13-2019, 07:12 PM.

    Leave a comment:


  • replied
    Originally posted by rakikavun View Post

    You should change "lower hemisphere color".. Make it more brighter. If you use hdri for skylight, you can disable it.
    Worked! Thx!

    Leave a comment:


  • replied
    Did anybody have the opportunity to test 2080 ti or maybe 1080ti vs 2080ti in GPU Lightmass?

    Leave a comment:

Working...
X