Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

(WIP) BakeLight - Editor Vertex and Texture Light Bake Tool

Discussion in 'Works In Progress - Archive' started by Haagndaaz, Feb 16, 2016.

  1. Haagndaaz

    Haagndaaz

    Joined:
    Feb 20, 2013
    Posts:
    232
    Lightmaps can take up a lot of space, so why not just bake that lighting into the vertices of your mesh? Now you can!

    BakeLight bakes Ambient Occlusion, Indirect Lighting, and Direct Lighting(still experimental, but functional).

    BakeLight has two parts, VertLight and TexLight. Each parts calculates lighting the in the same way, the difference being that VertLight bakes the lighting information into the vertices of the meshes, and TexLight bakes to a texture.

    NOTE: TexLight is still experimental, and is going to be improved over time :)

    Also, this is free! I think this tool is really useful for developers so I am just giving it away!

    NEW! Currently adding in Run-Time lightmapping! (one kink to work out yet)

    TexLight Images
    001.PNG 002.PNG
    VertLight Images vert001.PNG vert002.PNG
     

    Attached Files:

    Last edited: Mar 7, 2016
    tkayaist, JamesArndt, cl9-2 and 4 others like this.
  2. PixelMind

    PixelMind

    Joined:
    Aug 16, 2013
    Posts:
    101
    Looks really nice. Thanks for sharing!
     
  3. AndreiKubyshkin

    AndreiKubyshkin

    Joined:
    Nov 14, 2013
    Posts:
    213
    Hi! Many thanks for sharing the tool!

    Can this tool bake existing lightmaps into vertex colors or does it calculate the lighting information with it's own algorithm? Does "bake" (realtime, baked, mixed) option on the light matters ?
     
  4. Haagndaaz

    Haagndaaz

    Joined:
    Feb 20, 2013
    Posts:
    232
    Do you mean whether the light setting on each individual light get taken into account? If so, that is something yet to do, but a really simple addition.

    Lightmap transferring is a planned feature, definitely in the roadmap

    Some other things I am planning:
    - ability to bake objects and have them ignore the objects around them (only selfshadow)
    - better direct lighting algorithm
     
    theANMATOR2b and AndreiKubyshkin like this.
  5. AndreiKubyshkin

    AndreiKubyshkin

    Joined:
    Nov 14, 2013
    Posts:
    213
    Forgot to ask. Do you know a terrain splat shader that also works with vertex colors?
     
  6. Haagndaaz

    Haagndaaz

    Joined:
    Feb 20, 2013
    Posts:
    232
    Not that I know of, but i will add that to the top of the to-do list, since I know that is of big importance for you
     
    AndreiKubyshkin likes this.
  7. Haagndaaz

    Haagndaaz

    Joined:
    Feb 20, 2013
    Posts:
    232
    Updated BakeLight in the OP, some small changes from last night:

    - better direct lighting
    - more accurate progress bar

    Next up:

    - terrains!
     
    AndreiKubyshkin likes this.
  8. Haagndaaz

    Haagndaaz

    Joined:
    Feb 20, 2013
    Posts:
    232
    So it seems that terrains don't have anything like vertex colors, so I'm not sure how to go about baking vertex colors for a terrain. The only option then would be to convert the terrain to a mesh and then bake that
     
  9. Haagndaaz

    Haagndaaz

    Joined:
    Feb 20, 2013
    Posts:
    232
    Added in a mostly working runtime lightmapper that writes lightmaps to unity's builtin lightmap slot, so no extra shader required :) it also automatically splits into multiple lightmaps if necessary

    What this does is it allows you to have a small build size without any lightmaps in the build, and then just generate them at runtime, perhaps this could be a solution for you @AndreiKubyshkin

    There is just one kink with assigning the lightmap position data back to the renderer after atlasing the lightmaps, so if anyone has any ideas, please let me know!
     
    Last edited: Mar 7, 2016
  10. Dubz

    Dubz

    Joined:
    Feb 20, 2012
    Posts:
    19
    Does this allow you to blend the baked AO in with predefined Vertex colours?
     
  11. Haagndaaz

    Haagndaaz

    Joined:
    Feb 20, 2013
    Posts:
    232
    Not currently, although that could be easily done since it has access to the original mesh. Later on today I will add that in as well as including some recent bug fixes such as:
    - more predictable indirect lighting
    - fixed rotational errors
    - some speed and memory leaking fixed during bake process
    - improvements to Runtime Lightmapper (seam elimination)
     
  12. layola

    layola

    Joined:
    Aug 6, 2013
    Posts:
    94
    any update for these feature?
    such like this video
     
  13. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,938
    Very cool indeed. So could we consider this a lightmapping alternative to the Enlighten system? I'm really fed up with the complexity of baking some simple static lightmaps for a mobile game (in 5.3). It used to be dead simple with Beast in 4.6, baked out super fast and the results were easy to get looking nice.
     
  14. Haagndaaz

    Haagndaaz

    Joined:
    Feb 20, 2013
    Posts:
    232
    @JamesArndt Kind of, I would have to upload the latest version of the tool, but the latest version allows for baking indirect, direct, and ambient occlusion to vertex colors or to textures(although textures are super slow).

    I am also somewhere in the process of a runtime lightmapper that will be included as well, because why not right?
     
  15. vizgl

    vizgl

    Joined:
    Nov 4, 2014
    Posts:
    61
    Hi, great free tool! Do you have any progress on it?
     
  16. Haagndaaz

    Haagndaaz

    Joined:
    Feb 20, 2013
    Posts:
    232
    Unfortunately not, I have been quite busy with school and freelancing :(
     
  17. vanLiere

    vanLiere

    Joined:
    Jul 11, 2017
    Posts:
    7
    Will give this a try. Been looking for a simple baker that bakes light to diffuse texture :)