Search Unity

Baked light and tinted glass.

Discussion in 'Global Illumination' started by neginfinity, Oct 6, 2015.

  1. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,572
    Please note that I'm speaking strictly about baked lighting with unity standard shader.

    I've been playing around with global illumination in unity standard shader, and I've realized that when baked light passes through semi-transparent glass, it is not affected by color of the glass or transparency of the glass. Instead it is either completely cut off (if object's alpha is greater or equal to 0.5 (or 128 in 8bit value)) or it is completely let through (if it is less than 0.5).

    I tried coloring window glass red and adjusting parameters, there doesn't seem to be much difference.

    Is it actually how baked light works, meaning that you can't automatically create tinted glass that will color the scene? Or am I missing some setting somewhere?

    I mean, It is supposed to be a PBR shader. While I understand limitations of coloring dynamic lights that pass through tinted transparent object, we have that computationally expensive precompute/baking phase here, and light that came through tinted glass does not really need extra handling. Surely, this should be implemented?
     
  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,794
    Baked and realtime are not that different. Baked is realtime upsampled with the direct light recalculated at baked res.

    So, I'm guessing it will work when they add the feature to the realtime. (so sometime after 5.3)
     
  3. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,572
    That's not true.

    Baked (baked GI) lighting allows you to calculate light bouncing, which is impossible in realtime. Light will bounce off object and lit other objects. Put red cube near white wall, shine light source on it, and you'll see reddish light around the cube on the wall.

    Precomputed realtime GI builds sort of lookup table that allows to control parameters dynamically (color and intensity) while still letting light bounce to some extent.

    Real-time dynamic lighting does not calculate light bounces and only might use final lighting formula But that's it.

    They also won't be adding light tinting in foreseeable future, because it is a difficult problem. However, during baking calculation nothing stops anybody from tinting light color. If the shader is supposed to be PBR, that's what I'd expect it to do.
     
  4. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,794
    By "realtime" I meant the precomputed realtime GI which does bounce light. Baked GI uses the precomputed GI, upsampled, to output its lightmaps.

    (we are talking about Unity 5, right?)
     
  5. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,572
    You claim that realtime and baked GI are the same thing. Is there any official source that supports that statement?

    I'd expect data used by both systems to be different.
     
  6. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,794
  7. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,572
    The post does not say what you said. They explain where indirect lighting originate from. The wording is vague and can mean five different things in lighting system implementation - from system being identical to the lowres lightmap data being used to speedup initial compotation and then going separate ways from there.
    Based on experiments it certainly does not seem to "just add direct light" as you said earlier from in that thread.

    I made transparent window, painted it red and it didn't tint the color.
    Unity documents explain how per-pixel lighting works, which is what I called realtime.
    ---------
    Anyway, that's not related to the topic.

    The question was whether there's a way to affect light color with transparent objects.

    I have impression that apparently there isn't one, which is a pity.

    If there IS such feature and I overlooked it (doubtful by now), anyone else is welcome to point out where it is.
     
  8. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,794
    That's not what I said.

    (Also that's not what Kuba is saying).

    They are going to add GI going through transparency at some point after 5.3. Enlighten (at least 3+) is capable of it, they just haven't added the feature yet. When they add it to the precomputed realtime engine, I assume it will work for baked GI as well, since baked GI uses data from precomputed (although upsampled and with direct light redone), which I've been saying from the beginning.
     
  9. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,572
    Got it.

    Thanks for the response, I have no further questions.