Search Unity

Lightbake with water

Discussion in 'Global Illumination' started by peaj_metric, Jul 3, 2019.

  1. peaj_metric

    peaj_metric

    Joined:
    Sep 15, 2014
    Posts:
    146
    I am tying to bake a scene containing a water surface and would like to know if there are any workflows/tips/workorounds for this.

    As the water is using a grab pass shader the lightmapper seems to treat it like an opaque object. Thus leading to (dark) shadows on the water surface and weird artifacts on the ground below the water.
    Using a transparent shader (for the bake) instead does not seem to lead to proper results either.

    The current "solution" is to disable the water surface and get a reasonable result on the ground below but no shadows on the surface.

    The best possible solution would be for the lightmapper to treat it like real water (a thicker medium) and reflect/refract of the surface to calculate both shadows (on the surface and the ground below) but I guess the lightmapper just doesnt support fancy stuff like refraction.

    I am grateful for any tips/clues I can get on this.
    I cannot be the only one trying to bake a scene with water can I?

    Thanks,
    Pascal
     
  2. jRocket

    jRocket

    Joined:
    Jul 12, 2012
    Posts:
    700
    Water is a moving dynamic transparent body and should be static or part of the lightmapping. The lightmapper wouldn't be able to help anyways because water is moving and refraction would change every frame. You can fake the caustics with a custom shader.
     
  3. peaj_metric

    peaj_metric

    Joined:
    Sep 15, 2014
    Posts:
    146
    Hey jRocket,
    thanks for your answer.
    I'm not even talking about advanced lighting like caustics here.
    Think of a room filled with water (few cm) and a window.
    The cieling should obvously be a lot brighter as water reflects the light pretty well and the window should cast their light/shadows on the water surface as well as the floor below.