Jump to content

How can I make a transition between Gaia Lighting Profiles from a script?


Ugur Tuna
Go to solution Solved by Josh,

Recommended Posts

I need to make transitions between lighting profiles at the Unity play time. I tried a bit but couldn't figure out how to access and set them.  How can I make a transition between Gaia Lighting Profiles from a script? 

Lighting.png

Edited by Ugur Tuna
Link to comment
Share on other sites

  • Solution
29 minutes ago, Ugur Tuna said:

I need to make transitions between lighting profiles at the Unity play time. I tried a bit but couldn't figure out how to access and set them.  How can I make a transition between Gaia Lighting Profiles from a script?

Currently this is only avaliable in the editor, all the lighting setup code is editor only. Maybe in a future update we will make it so it can be done at play/realtime.

The editor function is:

gaiaSettings = GaiaUtils.GetGaiaSettings();
if (gaiaSettings != null)
{
	GaiaLighting.GetProfile(GaiaGlobal.Instance.SceneProfile, gaiaSettings.m_pipelineProfile, gaiaSettings.m_pipelineProfile.m_activePipelineInstalled, true);
}

The get gaia settings is also only editor only as it is not stored anywhere currently. The GaiaLighting is the static editor only class that does all the lighting setup.

So to do the lighting transition you'd need to code somethign in yourself, the scene profile data will all be there In GaiaGlobal.Instance.SceneProfile.m_lightingProfiles

This is a list of all the profile and all their settings, you can do a Mathf.Lerp or Color.Lerp for most of the settings in the profile. You'd just need to handle time so something like:

float time = Tile.deltaTime / m_duration

m_duration being a public float value on how long you want the duration to be.

Link to comment
Share on other sites

@Josh Well I can change the values but it only applies the changes from editor. Example: Fog1.thumb.png.d9cf260d2a8773eef432d8ea2fbc4850.png

With this code; it doesn't apply the changes and also the fog curve remains the same but if I pause the game and change the ligting profile to fifth profile (or another profile) by hand, at the editor, change back to sixth profile again from the editor and unpause, than the fog curve of sixth profile replaces with my values also it applies the changed values. I also tried: Fog2.thumb.png.814df93fba46e47d4c5d59c140302f39.png

Result is still the same. Is there a way to apply the changes or how can I acces the current active lighting profile and change the values?

Edited by Ugur Tuna
Link to comment
Share on other sites

27 minutes ago, Ugur Tuna said:

@Josh Well I can change the values but it only applies the changes from editor. Example: 

To apply any changes made in the lighting profile you have to call this function afterwards

Quote
gaiaSettings = GaiaUtils.GetGaiaSettings();
if (gaiaSettings != null)
{
	GaiaLighting.GetProfile(GaiaGlobal.Instance.SceneProfile, gaiaSettings.m_pipelineProfile, gaiaSettings.m_pipelineProfile.m_activePipelineInstalled, true);
}

Note it is Editor only function so can only be accessed in an editor script. We will rename this function in a future update to make more sense but yeah this is the function to apply all the changes in the profile.

Link to comment
Share on other sites

@Josh so I don't know a lot about editor functions but as I understand; there is nothing I can do to change the fog or any ligting setting at the playtime? Because I can't change and apply unity Render settings either.

Edited by Ugur Tuna
Link to comment
Share on other sites

@Josh I have 2 factions in my game; humans and monsters. I want to create different lighting profiles for each faction. The most important property is fog. If i will be able to change fog end distance and color I would be so glad. Player is beaming across the towns so smooth transition isn't needed.

Edited by Ugur Tuna
pronunciation mistake
Link to comment
Share on other sites

@Ugur Tuna Ah well the system uses gradient and not a static fog color or distance but you can setup additional fog color and distances

GaiaAPI.SetAdditionalFogColor(Color.red);
GaiaAPI.SetAdditionalFogLinear(200f);
GaiaAPI.SetAdditionalFogExponential(0.015f);

These values will help adjust the fog settings in the PW Sky

Color is mulitplied by the current color in the system.
And the distances are added or subtracted.

I think these are what you are looking for and it's these settings that are used in our Photo Mode to adjust the fog in the PW Sky system.

Link to comment
Share on other sites

  • 1 year later...

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...