Search Unity

Question How to create lower quality Light Probes?

Discussion in 'Global Illumination' started by GD-DavidStrife7, Jul 20, 2022.

  1. GD-DavidStrife7

    GD-DavidStrife7

    Joined:
    Mar 2, 2014
    Posts:
    4
    Hello everyone. Sorry to bother you all. Here's what I'm looking to achieve:

    If you remember older PS1/PS2 etc. games, they didn't use realtime shadows for the most part. When an object entered a shadowed space, the entire object would simply become darker. If you were 1cm within the light, and took one small step forward into a dark area, the entire dynamic object would fade down into a shadowed color.

    Light probes are obviously the technology I'm looking at, but they are too high quality for my project style. I'm looking for something that turns the entire object darker as they enter shadowed areas. It can be binary as in "step into light = full color albedo" and "step into shadow = shadow color abedo", but it would be nice to have something that slowly goes between fully lit object and fully shadowed object as you venture further into a shadowed area.

    Is there a way to butcher the light probe system so instead of affecting an object per vertex/fragment, it can affect the entire object at once?

    Thank you in advance for any support/advice/help you have.

    *Extra*
    For a specific example, see how Halo 2, Halo 3, and Halo: Reach deals with players walking into shadowed areas. The entire model goes darker, and not the vertices within the area or closer to a light probe.
     
  2. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Well in one of my old retro games, I simply had a trigger, and when you enter that trigger, the tint or shading would lerp to the new settings. I think that sort of trigger (volume) approach was common back then.

    Another tactic you could use is what oculus recommend in one of their old connect videos. Basically in Unity, you use a barycentric raycast to sample the lightmap under your feet and then shade the character according to the result you pass into the shader. This result can be massaged however you like in C# for a retro sort of look to the change (clamping or other).
     
  3. GD-DavidStrife7

    GD-DavidStrife7

    Joined:
    Mar 2, 2014
    Posts:
    4
    I like the volume method you mentioned, with the only caveat being it's exclusive to a simple switch between a binary state (as well as placing loads of volumes I guess haha), unless you made a middle-man transition volume between maybe.

    I'm quite interested in the raycast method you mentioned. I'll take a look into that too.

    Is there a way in C# code to sample the nearest light probe for a single value? I could then use that value within a clamped range to simply multiply an albedo texture then I would guess is the fastest/easiest way for that kind of approach?

    Would this be correct?
    https://docs.unity3d.com/ScriptReference/LightProbes.GetInterpolatedProbe.html