Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Using lighting from a different part of the scene

Discussion in 'Global Illumination' started by DougRichardson, Jun 4, 2018.

  1. DougRichardson

    DougRichardson

    Joined:
    Oct 7, 2017
    Posts:
    74
    Is it possible to use lighting from a different part of the scene?

    I use two cameras to render my scene for an first person shooter.

    The first camera renders the arms and gun. This camera, arms, and gun, stay at the scene origin.

    The second camera renders the rest of the scene. This camera moves around the scene (i.e., does not stay at origin).

    I'd like the arms and gun to be lit as if they were where the second camera is.

    Is this possible?
     
  2. DougRichardson

    DougRichardson

    Joined:
    Oct 7, 2017
    Posts:
    74
    Here's what I found out on my own.

    1. This can be done with Baked GI + Static Lights + Mesh Renderers with Anchor Override (aka Renderer.probeAnchor) and Light Probes. You move the Anchor Override to the position you want to light your object from. In my limited testing, this worked well.

    2. Starting with the setup in (1) but replacing Baked GI with Realtime GI, it works for indirect lighting but not direct lighting. That is, the object being lit gets its direct light from it's world position but gets its indirect light from the anchor override.

    Would love to hear from someone with more experience.
     
  3. DougRichardson

    DougRichardson

    Joined:
    Oct 7, 2017
    Posts:
    74
    It looks like I'll actually be able to simplify my game to 1 camera if I switch to HDRP, since the artifacts I experienced far from origin (~4096 units) are a lot less severe in the HDRP pipeline, I guess due to it's use of Camera Relative Rendering.