Search Unity

Question Playing with the baked lighting and rotation

Discussion in 'General Graphics' started by mcmount, Dec 17, 2022.

  1. mcmount

    mcmount

    Joined:
    Nov 15, 2015
    Posts:
    83


    Ok, this is quite interesting one; I have one space, no lights, all lights are just emitting from the roof "lamps". Set to static and baked. After this is turn off the static, so I can manipulate the position and the rotation of this single mesh. I have one corridor, a "hill", which gives the illusion you are walking forward and the space around you rotates. so you kind walk upwards, but as you do it, the scene rotates to compensate your rotation; you always walk at the floor level, but the scene rotates according your own position.

    Now, what I do, I use the same space mesh, and if the player is looking forward at when at the "hill" object, it gets relocated to the new position and rotation, so the view is seamless. Meaning, if you look back at the down of the hill, you see the space at the vector3.zero rotation and position. When looking forward, you see the same space in front of you tilted 90 degrees up and repositioned.

    What happens when you walk, and the scene rotates, all my walls go black. And I'm scratching my head why? The floor and the ceiling seems to be intact. All my code is fine, but the baked data just seems to forget what it should do. After all, only thing it has is a new rotation and position at the local level, but at the global level only the position and Y rotation has changed.

    I'm also using one script and a shader I created to have real time floor reflections from the scene, but it has nothing to do with that. Using Unity 2019.4.6f1 and Deferred path.

    Any hints?
     
    Last edited: Dec 17, 2022
  2. mcmount

    mcmount

    Joined:
    Nov 15, 2015
    Posts:
    83
    Answering to myself; Dude, DON'T rotate! You can move the baked stuff, but NEVER EVER rotate! Instead, copy your original game object, rotate only with the Y axis, move it off and bake. THEN reparent it. Now, when looking upwards, it's totally fu*ked up, but when tilted back to it's original rotation, it's just fine.

    Must be something how Unity maps this stuff, dunno.