Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Lighting, shader and GI is messing up the materials in Unity3D

Discussion in 'Global Illumination' started by zero_null, Jul 28, 2017.

  1. zero_null

    zero_null

    Joined:
    Mar 11, 2014
    Posts:
    159
    Hello Guys I am not very sound with Unity3D Lightmapping. Currently I have a set of low poly items in my scene. Textures on my models are getting washed out. They totally look absurd. here is a picture of expected (Right) vs current result (left)

     
  2. kemalakay

    kemalakay

    Unity Technologies

    Joined:
    Jul 12, 2016
    Posts:
    224
    Hey @ad_adnan

    To me it looks like you didn't set your mesh as static. You need to mark the object as static in the inspector to bake lightmaps. Secondly, you need to have proper UV layout for your object. Now, either you can import it from your DCC package, or create it in Unity automatically with Generate Lightmap UV option but you should always keep an eye on your UV layout to avoid overlapping UV charts. You can check your UVs in the Preview section under Object Map tab in Lighting window. Then, you can change Preview mode from Albedo to Baked Lightmaps.

    You should have enough padding between your UV charts. If you automatically generate them in Unity, then you can either increase packing margin under `Generate Lightmap UV` option or you can simply increase lightmap padding in Lighting window.

    Another important setting is in your lights. You need to change the mode of your Lights from realtime to baked, that's very important.

    Now, not sure how much you're familiar with Global Illumination concept, but it seems like you only care about baking lightmaps and not too much about dynamic objects. But I'm pretty sure you've objects that move around.

    First, I'd disable realtime GI and use only baked global illumination. As I said, if you only want to work with baking, then you can experiment with Progressive Lightmapper (which is still in preview stage, hence doesn't support all the features Enlighten does). But if you've moving characters in your level and want to use indirect lighting for them, then you can search for new light modes feature in Unity but that's only supported in Enlighten. There are already documentation pages and information across different threads on the forum so you should be good to start. For your art style, Subtractive seems like the right choice for lighting mode.

    In overall, there are few concepts you need to keep in mind when working with lightmapping and baking:
    1) Your mesh always needs to have correct UV layout. I can't stress this enough as this is where most people struggle the most. Object Map tab and debug visualization modes are your friend to understand what's going on.

    2) Don't forget to mark your game objects as static for lightmapping and setting your lights to baked. This should be quite obvious but a common mistake by beginners to skip.

    3) Baking in Enlighten can be cumbersome especially with large scenes but Progressive Lightmapper (PLM) addresses that issue. If you're only working with lightmapping, then PLM is a good alternative but it lacks some major features. It's getting there though and you can follow this thread to keep track of the progress.

    Hope it helps,
    Good luck!
     
  3. zero_null

    zero_null

    Joined:
    Mar 11, 2014
    Posts:
    159
    @kemalakay Super thanks for writing a comprehensive solution to my problem. I am really very thankful. I'll try to follow and look at each of the step you mentioned. Thanks allot again.
     
  4. zero_null

    zero_null

    Joined:
    Mar 11, 2014
    Posts:
    159
    can I use realtime and mixed both illumination ? or will it be a performance strike ?
     
  5. zero_null

    zero_null

    Joined:
    Mar 11, 2014
    Posts:
    159
    I don't know what DCC is ?
    Can you please explain them ?
    How can I generate UVs for each mesh ? through it's mesh rendere component by enabling Lightmap static ??
     
  6. kemalakay

    kemalakay

    Unity Technologies

    Joined:
    Jul 12, 2016
    Posts:
    224
    Yes, you can. Certainly there will be a performance overhead but that depends on your use case and target platform. And personally, I suggest to use either of them (realtime GI or baked GI) to understand how each system works. After grasping the functionality of both systems, you can combine and use however you like.

    DCC package is just another term for external applications such as 3DS Max, Maya or Blender. In order to use generate lightmap UVs, you need to click on your mesh in the project settings and open Mesh Importer and find the option there. Glad to help and hope it answers your question. Thanks
     
  7. zero_null

    zero_null

    Joined:
    Mar 11, 2014
    Posts:
    159
    @kemalakay super thanks buddy !
    you Really helped me.
     
  8. kemalakay

    kemalakay

    Unity Technologies

    Joined:
    Jul 12, 2016
    Posts:
    224
    Always a pleasure to help @ad_adnan

    There is also this talk that you can watch:


    Since you're new to baking in Unity, may I ask how you rendered your "expected" result? In the 3D app you're using, I assume? If so, which renderer are you using?

    Currently, unlike realtime Global Illumination we're lacking a proper manual page/tutorial for lightmapping but we're planning to create one. So stay tuned for more stuff! :)
     
  9. zero_null

    zero_null

    Joined:
    Mar 11, 2014
    Posts:
    159
    Thanks allot @kemalakay.
    I will for sure have a look at the video.
    Actually, I have bought the 3d package and they have created the renders in Cinema4D. The developer of package himself don't know much about lighting. Up til now I have been creating 2d and mini 3d mobile games but I need more details and I think baking is the key that might help me in getting desired results. Although I am not sure how to achieve results if I don't really need to bake stuff. Looks like there is just direction and ambient light with a suitable shader to get the effect.
     
unityunity