Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Let us know your feedback about the Global Illumination changes in the 2023.2 beta.
    Dismiss Notice
  3. Dismiss Notice

Enlighten Bake and UV layout problems

Discussion in 'Global Illumination' started by clevermango, Jun 27, 2016.

  1. clevermango

    clevermango

    Joined:
    Jan 7, 2015
    Posts:
    32
    Hello there,

    I am having a few problems with Baking with Enlighten.

    Typically, I avoid Baking with the engine at all costs. However, I have a scenario where I must lightmap a large quantity of Assets, within Unity.

    In essence, I am trying to import a model with UV0 set for Diffuse/Albedo, and UV1 set for the "lightmap"/Baked result. By lightmap, I am referring to the baked result from Enlighten.

    Despite preserving the UV's of the object, I believe Enlighten is repacking the UV shells. Having read around, this is normal for a Pre-computed result, however for a Baked result, when "Preserve UV's" is ticked on, Enlighten should not touch the UV shell co-ordinates. I can live with Enlighten re packing the UV shells. However, what is causing me a problem is the fact that Enlighten is packing the UV's that once filled the models UV space, into the bottom left corner of the map. The result of this of course is a Baked result that is 1/4 the resolution that it should be, despite the lengthily bake duration due to pretty high settings. I have tried pretty much every combination of settings on the Object and the scene as a whole. I cannot find a way to nicely bake an object, using the unwrapped UV's set in 3DS Max.

    In this case, the model is from 3DS Max. It has a diffuse set of UVs that overlap where required (UV1 in Max, UV0 in Unity). The secondary map (UV2 in Max, UV1 in Unity) is a non overlapping set of UV shells generated by unwrapping the object, allowing Max to position the UV shells within the UV space, ensuring that none overlap. The secondary map is used to bake AO in Max, which is a pretty typical approach. These UV's are also intended to be used for the Enlighten bake also. Which, they are been, however sadly they are been positioned by Enlighten in a very wasteful way within the UV space. So much so, the baked result is 1/4 the resolution that it is intended to be.

    I am finding the whole Bake process with Enlighten very troublesome, despite using it for some time now. I am able to get very nice results from it, however the render time is not manageable despite having a high amount of render power dedicated to Unity.

    Worse case scenario, I could bake the whole thing in 3DS Max, but this defeats the object of using Unity for its advanced lighting ability. In most cases I use realtime, but in this case I need to bake due to a large quantity of pixel lights required to pull of a large night time environment.

    I am wondering if anybody has any suggestions, or has encountered the same problems?

    Many thanks,

    CM
     
    theANMATOR2b likes this.
  2. clevermango

    clevermango

    Joined:
    Jan 7, 2015
    Posts:
    32
    Baked UVs

    Baked UVs are extracted from the imported mesh and used “as-is”. They are scaled to accommodate the desired resolution. The baking pipeline will use UV1 as the lightmap UVs. If these do not exist it will fall back to UV0. The mesh importer in Unity can generate a lightmap unwrap for you if you tick “Generate Lightmap UVs” (docs).

    ---

    I am so far yet to see the imported mesh use the UV's "as-is".
     
    Adam-Bailey likes this.
  3. clevermango

    clevermango

    Joined:
    Jan 7, 2015
    Posts:
    32
    Within Object, setting "Scale In Lightmap" to an object to 1e+07 (basically infinite) seems to force Enlighten to fill the UV space on a per object basis. Of course this would only work so long as each object within a scene is to be baked independently, without affecting other objects in the scene. Unless, Mixed lighting is used.
     
  4. Adam-Bailey

    Adam-Bailey

    Joined:
    Feb 17, 2015
    Posts:
    232
    As far as I can tell from reading around, that is outdated documentation. I have wasted a good few hours this week wondering what exactly I was doing wrong until I came across forum posts saying things had changed since that documentation was written.
     
  5. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    I'm a relative noob with Unity lighting - as I've been neck deep in mechanics and have not had the privilege of getting to - game play is fun, now on to lighting. ;)
    With that said - I'm pretty experienced with Max and baking AO for extra depth for textures.

    I usually bake my AO into the difuse texture - this is a subtle blend mode in Photoshop so as not to overpower the real-time lighting in engine.
    Question - Why use a different set of UVs in Max to generate AO? Why not fix the first set of UVs so they aren't overlapping and duplicate diffuse texture where needed instead of overlapping UVs?
    This would clear up the second set of UVs for Unity to use for baking - which is what Unity expects to have available for baking.

    Unless the AO is going to be used in real-time lighting as a kind of multiplier to enhance recessed areas of the models, I don't understand why using a second set of UVs is needed for AO - other than the overlapping UVs in UV set one.

    I have general interest in your workflow - I really enjoy learning other artists processes - being a lone artists without colleagues to discuss process/workflow decisions, and I enjoy helping others when I can.
     
  6. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    10,963
    For baked it indeed does not mess with the UVs. It does Atlas everything together though. Not sure what you're expecting?

    Compared to the realtime UVs where it does whatever it wants, it's as close to "as is" as possible.