Search Unity

Runtime light baking [Solved]

Discussion in 'General Graphics' started by D43DB33F, Mar 3, 2018.

  1. D43DB33F

    D43DB33F

    Joined:
    Apr 6, 2017
    Posts:
    43
    Hi ! I am working on a game where players can create their own race tracks out fundamental elements like cubes, a bit like Minecraft does. However, the lighting looks crap, because it is not baked (I assume). I can't perform baking from the editor since the content of the race track only exist at run-time. I can also not bake elements individually into their own scene as I saw in another suggestion, because the lighting depends on surrounding elements so it doesn't really make sense.

    So my question is : is there anything in the Unity API that allows performing baking at runtime ?

    I am fully aware that baking can be a greedy process that can't be done while playing without making the game run very slowly. But I could perform the baking when the user saves his race track or let the user decide when to do it. The baking info would then be stored into the same file that defines the content of the race track.

    Thanks.

    EDIT : I found : Lightmapping.Bake(); but this doesn't seem to affect the graphics, for some reason. I've also set my blocks as "static", but doesn't help.

    EDIT : I'm adding my lighting settings as attached file
     

    Attached Files:

    Last edited: Mar 4, 2018
    jacknero likes this.
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    Nope.

    That's an editor only function. It either won't do anything or will error if you try to call it at runtime.

    If you want baked lighting you'd have to write it all yourself, or look for an asset on the store that can do runtime baking. I know there are a couple of light baking assets on the store to replace the built in one(s), and some may be capable of working at runtime.
     
    Raptosauru5 likes this.
  3. Lex4art

    Lex4art

    Joined:
    Nov 17, 2012
    Posts:
    445
    Try SEGI - it's free now, maybe it will do the job for your project even in current *unfinished* state.
     
  4. D43DB33F

    D43DB33F

    Joined:
    Apr 6, 2017
    Posts:
    43
    Thanks for the help guys. I will look into this SEGI thing, cause my game really looks ugly right now.

    EDIT : Tried SEGI and it looks nice. I struggled a moment to get it working in my existing project, but once it works it looks nice. It's greedy in terms of performance though. I can gain 5 FPS by disabling the "Update GI" thing, which I assume updates GI in real time, which I don't car about sicne my scene is mostly static, but still greedy.
     
    Last edited: Mar 9, 2018
  5. jsr2k1

    jsr2k1

    Joined:
    Aug 11, 2010
    Posts:
    118
    Hello everyone,

    I am also interested in this feature. I think it is very important for games where the user can create their own levels. With just 15 minutes the user could calculate a very nice global illumination (with a high-end pc). I am working on a level editor for interior design (Archviz) and I need to achieve the best visual quality.

    I have read on another post about command line option to calculate the lighting, but I don't understand if this is possible.

    Do you know if Unity developers are interested in developing this feature in the future?

    What is the best option now to accomplish this?

    Thanks in advance!

    Joel
     
    MilenaRocha and Raptosauru5 like this.
  6. Hafazeh

    Hafazeh

    Joined:
    Mar 26, 2017
    Posts:
    18
    Afak the only engine that let's you bake at runtime is UE4.

    Unity doesn't have this .
     
  7. m4d

    m4d

    Joined:
    Jan 25, 2012
    Posts:
    27
    Unfortunately Unreal does not support runtime baking. Your best bet in Unity would be the aforementioned SEGI or maybe POLM at some time in the future when it bakes GI.