Jump to content

Lighting in built version not matching editor


jpw

Recommended Posts

I have a problem which I'm not sure is even related to the nice Time of Day tool, but maybe it is. The lighting in my editor version is what I want - a dark night. But when I build the game and run it, the lighting is very weird. Can you please help me diagnose what is wrong? The time is set to midnight (24) in the time of day component.

This is how it looks in the editor and this is what I want:

spacer.png

And this is how it looks in the built version which is what I do not want:

spacer.png

As a lil bit of perhaps important info: in the editor, for a split second when the scene is loading, it appears all bright and weird like that before the lighting works properly.

Link to comment
Share on other sites

Can you please tell me if you are using the standalone version of HDRP or the built in one in Gaia Pro 2021? 

 

Link to comment
Share on other sites

2 minutes ago, Bryan said:

Can you please tell me if you are using the standalone version of HDRP or the built in one in Gaia Pro 2021? 

 

Standalone. I purchased the non-pro version of Gaia 2021 but have not installed it yet.

Link to comment
Share on other sites

Some extra info I should mention: I have two areas in the scene and one of them is day, the other is night. The daytime one always looks perfect & exactly how I want in both the editor and built version. I use this code to swap the time & weather conditions on the button click:

        timeOfDay.StopWeather();
        if (index == 0)
        {
            timeOfDay.TimeOfDay = 14;
            timeOfDay.StartWeather(1);
        }
        if (index == 1)
        {
            timeOfDay.TimeOfDay = 24;
            timeOfDay.StartWeather(0);
        }

Here is how the other area looks:

d9Jui04.png

and here they are side by side in the scene. The button moves the camera along the X axis and changes the weather with the code above:

eKw65J1.png

Link to comment
Share on other sites

4 hours ago, jpw said:

Some extra info I should mention: I have two areas in the scene and one of them is day, the other is night. The daytime one always looks perfect & exactly how I want in both the editor and built version. I use this code to swap the time & weather conditions on the button click:

        timeOfDay.StopWeather();
        if (index == 0)
        {
            timeOfDay.TimeOfDay = 14;
            timeOfDay.StartWeather(1);
        }
        if (index == 1)
        {
            timeOfDay.TimeOfDay = 24;
            timeOfDay.StartWeather(0);
        }

Here is how the other area looks:

d9Jui04.png

and here they are side by side in the scene. The button moves the camera along the X axis and changes the weather with the code above:

eKw65J1.png

Okay so i looked into this and i think i may know the cause since you are just switching TOD from x to z right away there is a bug in exposure what when light source switch exposure has a hard time adjusting to the change. Also this could be linked to SSGI could you please disable Use SSGI in advanced lighting and let us know if that still causes a problem.

Another solution would be using a coroutine or a few frames in update function to have the TOD system call timeOfDay.Refresh() which hopefully should get the exposure to update if this is the cause.

Also do you have any baked reflection probes in the scene? tod system uses a custom one that works with the time of day system and baked probes would not be required.

 

Let us know your finding and update us on the suggestions i am recommending to get to the bottom of the problem.

 

Josh

Link to comment
Share on other sites

Thanks Josh, I tried your suggestions. Regarding the baked reflection probe, I don't think I have any but I am not sure. I use the Magic Light Probes tool to generate it all. As for your suggestions: First I tried disabling SSGI - it had no impact. So then I tried your other suggestions in the following ways:

timeOfDay.StopWeather();
        if (index == 0)
        {
            timeOfDay.TimeOfDay = 14;
            timeOfDay.StartWeather(1);
        }
        if (index == 1)
        {
            timeOfDay.TimeOfDay = 24;
            timeOfDay.StartWeather(0);
        }
        timeOfDay.RefreshTimeOfDay();

This didn't change anything. So I tried using RefreshLights() instead, also no difference. Then I tried with a coroutine like you said:

      timeOfDay.StopWeather();
        if (index == 0)
        {
            timeOfDay.TimeOfDay = 14;
            timeOfDay.StartWeather(1);
        }
        if (index == 1)
        {
            timeOfDay.TimeOfDay = 24;
            timeOfDay.StartWeather(0);
        }
        
        StartCoroutine(RefreshWeather());
    }

    IEnumerator RefreshWeather()
    {
        for (int i = 0; i < 3; i++)
        {
            yield return new WaitForSeconds(1);
            timeOfDay.RefreshTimeOfDay();
        }
    }

It also had no impact. If I change it from setting to 9 instead of 24, no problem occurs as well. So it might be due to the extreme change in light like you say.

But I did find a workaround that works! This is the workaround:

        timeOfDay.StopWeather();
        if (index == 0)
        {
            timeOfDay.TimeOfDay = 14;
            timeOfDay.StartWeather(1);
        }
        if (index == 1)
        {
            StartCoroutine(GradualChange());
            timeOfDay.StartWeather(0);
        }
    }

    IEnumerator GradualChange()
    {
        for (int i=15; i<=24; i++)
        {
            timeOfDay.TimeOfDay = i;
            yield return new WaitForEndOfFrame();
        }
    }

 

Link to comment
Share on other sites

On 7/14/2022 at 6:10 AM, jpw said:

Thanks Josh, I tried your suggestions. Regarding the baked reflection probe, I don't think I have any but I am not sure. I use the Magic Light Probes tool to generate it all. As for your suggestions: First I tried disabling SSGI - it had no impact. So then I tried your other suggestions in the following ways:

timeOfDay.StopWeather();
        if (index == 0)
        {
            timeOfDay.TimeOfDay = 14;
            timeOfDay.StartWeather(1);
        }
        if (index == 1)
        {
            timeOfDay.TimeOfDay = 24;
            timeOfDay.StartWeather(0);
        }
        timeOfDay.RefreshTimeOfDay();

This didn't change anything. So I tried using RefreshLights() instead, also no difference. Then I tried with a coroutine like you said:

      timeOfDay.StopWeather();
        if (index == 0)
        {
            timeOfDay.TimeOfDay = 14;
            timeOfDay.StartWeather(1);
        }
        if (index == 1)
        {
            timeOfDay.TimeOfDay = 24;
            timeOfDay.StartWeather(0);
        }
        
        StartCoroutine(RefreshWeather());
    }

    IEnumerator RefreshWeather()
    {
        for (int i = 0; i < 3; i++)
        {
            yield return new WaitForSeconds(1);
            timeOfDay.RefreshTimeOfDay();
        }
    }

It also had no impact. If I change it from setting to 9 instead of 24, no problem occurs as well. So it might be due to the extreme change in light like you say.

But I did find a workaround that works! This is the workaround:

        timeOfDay.StopWeather();
        if (index == 0)
        {
            timeOfDay.TimeOfDay = 14;
            timeOfDay.StartWeather(1);
        }
        if (index == 1)
        {
            StartCoroutine(GradualChange());
            timeOfDay.StartWeather(0);
        }
    }

    IEnumerator GradualChange()
    {
        for (int i=15; i<=24; i++)
        {
            timeOfDay.TimeOfDay = i;
            yield return new WaitForEndOfFrame();
        }
    }

 

Thank you for trying i will dig into this a bit more i think it is the exposure issue and will see if i can add some exxposure refresh function in the Time of day system.

Yeah unity exposure for some reason changing from day to night in one frame causes exposure to not update correctly glad you found a workaround for now will try find a real solution to this matter and if i do will add it in the next update of the system.

  • Thanks 1
Link to comment
Share on other sites

  • 3 weeks later...
40 minutes ago, jpw said:

Any news on this one Josh?

Still looking into a permanent solution right now in the up-coming update the changes do work but really depends on how people use the system. Still in testing and of course fixing a few other bugs and adding a few new features/additions to existing systems.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Tell a friend

    Love Canopy - Procedural Worlds? Tell a friend!
  • Need help?

    We work with some of the biggest brands in global gaming, automotive, technology, and government to create environments, games, simulations, and product launches for desktop, mobile, and VR.

    Our unique expertise and technology enable us to deliver solutions that look and run better at a fraction of the time and cost of a typical project.

    Check out some of our non-NDA work in the Gallery, and then Contact Us to accelerate your next project!

×
×
  • Create New...