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

Question Enlighten with origin shifting

Discussion in 'Global Illumination' started by snacktime, Aug 1, 2022.

  1. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    Curious how this would impact realtime GI. Are there things that use world coordinates that would create a noticeable adaptation period when you drastically change the position of something, but where relative position is still the same?
     
  2. rasmusn

    rasmusn

    Unity Technologies

    Joined:
    Nov 23, 2017
    Posts:
    99
    I'm not quite sure what you mean by "noticeable adaptation period" but I'll try to answer as best I can.

    To my knowledge, Enlighten deals in world space coordinates stored in a floating point format. This means that it suffers from the typical floating point precision problem.

    As you may already know, floating point formats are precise near zero -- and the farther you get from zero the less precise they are, i.e. the more quantization you'll see (the gaps between each representable real number get larger).

    So even though a chunk of GameObjects may look fine when centered around (0, 0, 0), it may exhibit artifacts when moved far away from the origin, say to (50000, 0, 0). This is a general drawback of the floating point format and not specific to Unity nor Enlighten (although various software may employ different strategies for how to mitigate it).

    One general advice for dealing with these problems is to change how you think of Unity's unit of distance, such that you avoid these large numbers, and then adjust your game objects, models, etc. accordingly . For example, instead of thinking about Unity's unit of distance as a meter, you can think of them as kilometers in which case (5, 0, 0) would mean 5000 meters away from the origin (note how this avoids having large numbers in your coordinates).

    If I misunderstood your question, I ask that you provide more information and elaborate what you mean by "noticeable adaptation period". Thanks!
     
    CosmicStud likes this.
  3. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    More specifically It's how moving objects at runtime impacts illumination.

    So after some testing. Realtime baked data is obviously local. It creates separate maps per object. If you move objects even at runtime they still illuminate and there doesn't appear to be any noticeable adaptation time. Although moving them might make the baked data no longer correct. Ie baked objects that impact each other are only correct so long as their relative positions stay the same.
     
  4. rasmusn

    rasmusn

    Unity Technologies

    Joined:
    Nov 23, 2017
    Posts:
    99
    Thanks for the clarification. To my knowledge we do not officially support any kind of movement for objects that affect realtime GI -- not even if their relative positions don't change.

    That said, I don't see any immediate reason why it wouldn't work if you did it anyway.