Ugur Tuna Posted January 10, 2022 Posted January 10, 2022 (edited) 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? Edited January 10, 2022 by Ugur Tuna
Solution Josh Posted January 10, 2022 Solution Posted January 10, 2022 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.
Ugur Tuna Posted January 11, 2022 Author Posted January 11, 2022 (edited) @Josh Well I can change the values but it only applies the changes from editor. Example: 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: 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 January 11, 2022 by Ugur Tuna
Josh Posted January 11, 2022 Posted January 11, 2022 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.
Ugur Tuna Posted January 11, 2022 Author Posted January 11, 2022 (edited) @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 January 11, 2022 by Ugur Tuna
Josh Posted January 11, 2022 Posted January 11, 2022 Are you using the PW Sky system or just static lighting?
Ugur Tuna Posted January 11, 2022 Author Posted January 11, 2022 (edited) @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 January 11, 2022 by Ugur Tuna pronunciation mistake
Josh Posted January 11, 2022 Posted January 11, 2022 @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.
Josh Posted January 11, 2022 Posted January 11, 2022 You're welcome. The default values are: Color: White, Fog Linear and Exponential: 0f.
EarthHobbit Posted September 1, 2023 Posted September 1, 2023 Hi - Is it now possible to change at runtime or still only from editor ?
Bryan Posted September 2, 2023 Posted September 2, 2023 7 hours ago, EarthHobbit said: Hi - Is it now possible to change at runtime or still only from editor ? Editor only
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now