Home Unreal Engine

Build Lighting using command line?

polycounter lvl 10
Offline / Send Message
melviso polycounter lvl 10
I am not sure how to go about this:

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
As a ue4 script/tech noobishy, Where d u enter the above? In the output log?

Replies

  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    Thats not the question, but where is this from? :D Normally you can open up the console be pressing ~ in editor, unless you have your custom shortcut.Alternatively you can upen up the output log, and that has a console input. In game, you cant really upen up the console. I would like to see the context of this. why do you need to run light building from the console? Is this the gpu lightmass baker?
  • melviso
    Offline / Send Message
    melviso polycounter lvl 10
    Yes, the gpu lightmass baker:
    https://forums.unrealengine.com/development-discussion/rendering/1460002-luoshuang-s-gpulightmass
    I am not sure how to go about it. I seem to be having issues getting the gpu to build sometimes it works sometimes it doesn't. I have also set the TDR delay to about 300.
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    Okay. To run a console command in game, open up the level blueprint, put an "execute console command" node, hook it up to event begin play, and put your console command into the node. This will make the console command to be executed once you run the game.
  • melviso
    Offline / Send Message
    melviso polycounter lvl 10
    Thanks a ton, mate. :smile:
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    Show me them results . I'm kinda curious about the gpu baker. In theory, it would make a lot of sense though, because gpu is highly optimized for parallel computation, so it should give you better results faster than the cpu equivalent.
  • melviso
    Offline / Send Message
    melviso polycounter lvl 10
    I will, haha. The gpu baker rendered within 12 mins compared to the cpu which was 1: 52 hrs. That's crazy. I will try to post something soon. I am importing assets now that lighting hopefully is no longer an issue. 
  • musashidan
    Offline / Send Message
    musashidan high dynamic range
    Been testing GPULightmass myself recently. It's lightning fast compared to CPU. It deals with lightmaps a lot better too, and because it's brute-force directly on the GPU, that awful problem with lightmap seams, that was caused by multiple CPU threads, on flush modular elements is completely gone. The results are really impressive too, similar to the difference in quality between offline irradiance caching and brute force.
  • melviso
    Offline / Send Message
    melviso polycounter lvl 10
    Yeah, no lightmap seams wth modular. I don't think it supports baked ao atm but the lighting is sufficient enough to get photorealistic  results.
    Give it a try, Obscura. I will post something soon :- )
  • melviso
    Offline / Send Message
    melviso polycounter lvl 10
    Some pics:

    Lighting only. The full scene took 12 mins only. I would upload the full scene animations when done. Gonna lay in some sculpts on the pillows and sheets :- ) I don't think I am ever going back to cpu for lightmass rendering.

  • melviso
    Offline / Send Message
    melviso polycounter lvl 10
    Someone just explained how to  build lighting from command line :
    ----------------------------------------------------------------------------------------------------------------------------------------------------
    https://forums.unrealengine.com/development-discussion/rendering/1460002-luoshuang-s-gpulightmass/page22
    Post 317

    I figured out my gpu was overloaded with having other 3d apps on while lightmass was rendering so I freed up the gpu to only work with ue4. I have two gpus on my system so that helped a ton. I was about to try Obscura's directions when I realized it. So there was no longer the need to launch lightmass using command line. I am wondering if it's the same thing or different.
  • musashidan
    Offline / Send Message
    musashidan high dynamic range
    melviso said:

    Lighting only. The full scene took 12 mins only. I would upload the full scene animations when done. Gonna lay in some sculpts on the pillows and sheets :- ) I don't think I am ever going back to cpu for lightmass rendering.

    Never thought I'd say this about Lightmass, but 12 mins seems like a long time to build the lighting in that scene. :) I tested GPULM on the Epic Arch-Vis scene and it took less than 2mins with all textures/mats applied.

    Not sure about the command line thing as I haven't needed to use it yet.
  • melviso
    Offline / Send Message
    melviso polycounter lvl 10
    I am using a GTX 780m, its quite an old gpu card tbh.  Compared with the current cards, it would take longer.
    I am not sure about the command line thing either. Obscura was just trying to be helpful and he is an awesome dude. I think the command line is meant to start the lighting building for that particular project without the ue4 editor ever launching therefore conserving video memory in the process... I think.
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    The way I described is just an alternative way compared to the one written in the original post. Im not sure if any of them would give less video memory usage , because I havent tried. Either way, 12 minutes sounds a lot to me too, for such a small scene. Maybe you have needlessly high settings set?
  • melviso
    Offline / Send Message
    melviso polycounter lvl 10
    For archiz, u will need high lightmap sizes in other to catch the shadows for a photorealistic look. Gpu lightmass does not allow smoothing of shadows so I have to crank the lightmaps up. For 12 mins, that's huge in archviz. Believe me, I have had to wait for 5 hrs just to render one image for a room lol using an offline renderer. Some people have to use render farms for still images.

    I will check the scene again and see if there are somethings I can optimize,  I do feel its the lightmap sizes I am using though.
  • musashidan
    Offline / Send Message
    musashidan high dynamic range
    Obscura said:
    Maybe you have needlessly high settings set?
    @obscura That's the thing with GPULM, the settings are maxed out by default. It runs on production mode only(this is more to avoid errors the dev says)

    You just crank the radiosity to 10 indirect light bounces in world settings and that's it. Because it's a brute force renderer and doesn't use irradiance caching there are no settings to fiddle with. It's just like setting Vray to brute force progressive rather than irradiance/light cache.

    But yes, the tradeoff is higher res lightmaps as there is no light cache-type smoothing to blend out the blotchiness. But it is unbelievably fast.
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    I see. I should give it a shot just to see it myself in action. The truth is, nowadays I rarely do things that would require any light baking.
Sign In or Register to comment.