[Beta 2] GI: Inverse squared falloff for progressive lightmapper

First off… Yay! Light falloffs now look much much nicer and light fades much more naturally.

But… I have some questions/feedback.

  1. How can it actually be proper inv^2 if it’s still affected by “Range”? This really does not make sense. How can I have an intensity of 8 and a range of 5 and then have an intensity of 1 with the same range and then have both be inv^2?

  2. Since you are reworking this, maybe it’s time to make Range not affect the intensity? Like I want a light that has a certain intensity and falls off properly. The range shouldn’t affect it. Range should just act as a cut off. This may make falloffs look weird if the range isn’t long enough, but that is easily fixable. Or maybe Unity could suggest an appropriate range for the intensity I want, so it cuts off at a part where light has lost most of its energy?

If I’m baking a light, I don’t really care about range anyway. Area lights don’t have range, emissive lights don’t have range. I understand it’s important in realtime, for performance purposes, but if I’m baking it I don’t really care about that.

  1. Is everything now inv^2? By which I mean, is light coming from emissive surfaces also falling off properly? Is bounced light also falling off properly? If yes, then why do they look so different than direct lights?

Look at the image below, I have an area light (on the right) an emissive light with same size and intensity (middle) and a spot light on the left. I played around with the spotlight settings to try and make it look as close to the other two as possible, but it just won’t happen. Which makes me think that light falls off differently.

1 Like

How do you switch the light falloff in 2017?

so. . . all of our post are gone due the rollback.
ah well

Yeaaaah… uhhh…

I believe you posted these links, which are intersting :

https://docs.unity3d.com/2017.1/Documentation/ScriptReference/Light.SetAllLightsFalloffToInverseSquared.html
https://docs.unity3d.com/2017.1/Documentation/ScriptReference/Light.SetFalloffTable.html

Sounds like a ton of falloff control is coming, which is cool, although from what little testing I did, they don’t seem to do anything in the progressive lightmapper.

And the point I’m trying to make, are the falloffs for indirect light/area lights etc also using inv^2? (they should be, but it doesn’t look like it)

this is in the beta2 changelog

GI: Inverse squared falloff for progressive lightmapper.

Also the title of the thread :smile:

My “issue” is it only seems to apply to spots and points and nothing else.

ah. . . i totally forgot about that. Lol :smile:

@AcidArrow any news about the SetAllLightFalloffToInvSqr stuff?
surprisingly there’s lot of hidden stuff in 2017 with not sure why those thing are hidden

Hey,

Programmable light falloff feature is not added to Progressive Lightmapper yet so it’s for Enlighten-only, but lighting team is currently working on it so it’ll soon be available :slight_smile:

Thanks

are those only affect the lightmap, or also work for realtime falloff?

It’s only for baked lights at the moment, not for realtime lights

ah so that’s why i can’t see the differences in realtime

@Reanimate_L

Yes, unfortunately it doesn’t work for realtime lights yet but it’s on the roadmap.

And also, for those who are interested in using the feature, here is a more user friendly script. By using this one, you can use Animation Curves to change the light falloff instead of hard-coding it and attach it to the light:

using UnityEngine;
using System.Collections;

[ExecuteInEditMode]
public class CustomFalloff : MonoBehaviour
{
    public AnimationCurve LightCurve;
    [HideInInspector]Light lightComp;

    // Calculate the falloff curve matching the built-in falloff in Unity.
    const int kSampleCount = 13;
    public float[] lookup = new float[kSampleCount];
    public float[] table = new float[kSampleCount];

    const float toZeroFadeStart = 0.8f * 0.8f;
    private float[] samples;


    void Update()
    {
        UpdateFalloff ();
        //InverseSquare ();
    }

    void UpdateFalloff()
    {
        lightComp = GetComponent<Light>();
        lookup[0] = 1;
        lookup[1] = 1;

        for (int i = 2; i < kSampleCount; i++)
        {
            lookup[i] = 1;
        }
        
        samples = new float[13];
    
        for(int i = 0; i<samples.Length; i++)
        {
            table[i] = Mathf.Clamp01(LightCurve.Evaluate((float)i/12));
        }
        
        lightComp.SetFalloffTable(table);
    }

    void InverseSquare()
    {
        lightComp = GetComponent<Light>();
        
        Light.SetAllLightsFalloffToUnityLegacy();
    }
    
}
2 Likes

Oooh can you add this one to the documentation?

Thanks for the feedback.

Unfortunately, we’re taking out the feature for now. The feature will be available in 2017.2 with Scriptable Render Pipeline feature.

Adding proper tools to control the falloff is also in the plan. Using AnimationCurve is sort of a workaround anyway :slight_smile:

Thanks

That’s seems a great plan