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. Dismiss Notice

Move Static Object or Bake Non Static Objects?

Discussion in 'Global Illumination' started by Matze_MP, Nov 14, 2019.

  1. Matze_MP

    Matze_MP

    Joined:
    Dec 4, 2018
    Posts:
    37
    Hi, i got a looping environment that moves in the world dircetions. I want to bake Lights on this looping Environment. Unfortunatly it seems like objects cant be animated via timeline or moved in runtime when marked as static, is that correct?

    How can i bake Lightmapping on non static Objects? Everytime i remove static the baked lightmap dissapear.. i wished unity is more flexible with its lightmaps.. Are there some Scripts that toggle in baked Lightmaps or give me the opportunity to select custom Lightmaps?
     
  2. thefranke

    thefranke

    Unity Technologies

    Joined:
    Jun 20, 2015
    Posts:
    153
    Hey Matze_MP,

    just to understand your usecase: You want to bake Lightmaps, but for objects that move during runtime? The purpose of marking objects as Lightmapped is to tell the baking pipeline that these objects do not change in relation to lighting, so they that lighting on them can be precomputed. If that relationship breaks, you get lighting that is simply wrong, for instance a shadow that was baked because an object occluded that area is now still showing a shadow even though that object moved away.

    Can you clarify?

    Cheers
     
  3. Matze_MP

    Matze_MP

    Joined:
    Dec 4, 2018
    Posts:
    37
    Hi, thanks for your answer. I got an Environment thats move towards the player, the Player does not move in z directions but the Environment does. The Lightning for this Environment is static at all all Objects stays on the same place and an overall null Object is moving the Environment.

    Maybe some other example that have the same problem. I got a car. The interior is static at all, i want to bake this interior of a car,. But when i move the Overall Car on the street, the Interior does not move because it is not allowed to move. I understand that most of the time moving baked objects doesnt make sense, but getitng more advantage usage of the lightmapping would be great. Or is there any other solutions for cases like that?


    I dont know the Roadmap for Lightmapping at all, but i guess it would also be great to give users advanced Options for Lightmapping, like a Layering system of different lightmaps in one scene or allowing prefab lightmapping.
     
  4. konsic

    konsic

    Joined:
    Oct 19, 2015
    Posts:
    995
    I think you can't move baked objects.
    Did you try to use light probes for dynamic objects? They have 2 modes now. I'm not sure how they work exactly.
     
  5. wagenheimer

    wagenheimer

    Joined:
    Jun 1, 2018
    Posts:
    318
    I have 16 objects on my scene that are Static (they will never move), but they can be Enabled and Disabled. They all will start disabled buy can be bought and enabled anytime.

    I'm targeting low-end PCs, so I will need backed lightning and shadows.

    But if I use baked, the shadows will appear even when the object is disabled.

    What alternative should I use to support this and that has the best performance?
     
  6. ADufay

    ADufay

    Unity Technologies

    Joined:
    Jan 2, 2020
    Posts:
    30
    Hello wagenheimer !
    Unfortunately what you are asking for (dealing with enabled/disabled objects) looks the same as dealing with dynamic objects. Have you considered switching to light probes for these objects? Otherwise, if you just don't want these disabled objects to cast shadows you could disable them when baking. Unfortunately, they will still not cast shadows when enabled, but at least you don't have shadows that come from nowhere when these objects are disabled. I hope that helps.