private void SaveColorAndCubemapFields(GaiaLightingProfileValues newProfileValues, GaiaLightingProfileValues profileValues) { newProfileValues.m_sunColor = profileValues.m_sunColor; newProfileValues.m_lWSunColor = profileValues.m_lWSunColor; newProfileValues.m_hDSunColor = profileValues.m_hDSunColor; newProfileValues.m_skyboxTint = profileValues.m_skyboxTint; newProfileValues.m_hDGradientTopColor = profileValues.m_hDGradientTopColor; newProfileValues.m_hDGradientMiddleColor = profileValues.m_hDGradientMiddleColor; newProfileValues.m_hDGradientBottomColor = profileValues.m_hDGradientBottomColor; newProfileValues.m_hDHDRISkybox = profileValues.m_hDHDRISkybox; newProfileValues.m_hDProceduralSkyTint = profileValues.m_hDProceduralSkyTint; newProfileValues.m_hDProceduralGroundColor = profileValues.m_hDProceduralGroundColor; newProfileValues.m_hDPBSGroundAlbedoTexture = profileValues.m_hDPBSGroundAlbedoTexture; newProfileValues.m_hDPBSGroundEmissionTexture = profileValues.m_hDPBSGroundEmissionTexture; newProfileValues.m_hDPBSSpaceEmissionTexture = profileValues.m_hDPBSSpaceEmissionTexture; newProfileValues.m_hDPBSAirOpacity = profileValues.m_hDPBSAirOpacity; newProfileValues.m_hDPBSAirAlbedo = profileValues.m_hDPBSAirAlbedo; newProfileValues.m_hDPBSAirTint = profileValues.m_hDPBSAirTint; newProfileValues.m_hDPBSAerosolAlbedo = profileValues.m_hDPBSAerosolAlbedo; newProfileValues.m_hDPBSHorizonTint = profileValues.m_hDPBSHorizonTint; newProfileValues.m_hDPBSZenithTint = profileValues.m_hDPBSZenithTint; newProfileValues.m_skyAmbient = profileValues.m_skyAmbient; newProfileValues.m_equatorAmbient = profileValues.m_equatorAmbient; newProfileValues.m_groundAmbient = profileValues.m_groundAmbient; newProfileValues.m_fogColor = profileValues.m_fogColor; newProfileValues.m_hDVolumetricFogScatterColor = profileValues.m_hDVolumetricFogScatterColor; newProfileValues.m_profileType = profileValues.m_profileType; }
/// <summary> /// Adds a new user profile /// </summary> private void AddNewCustomProfile() { //GaiaLightingProfileValues selectdValues = m_savedSettings.LoadSettings(m_profile, true); GaiaLightingProfileValues selectdValues = m_profileValues; GaiaLightingProfileValues newProfile = new GaiaLightingProfileValues(); GaiaUtils.CopyFields(selectdValues, newProfile); int count = m_profile.m_lightingProfiles.Count + 1; newProfile.m_typeOfLighting = "New User Profile " + count; newProfile.m_userCustomProfile = true; m_profile.m_lightingProfiles.Add(newProfile); m_profile.m_selectedLightingProfileValuesIndex = m_profile.m_lightingProfiles.Count - 1; if (m_profile.m_selectedLightingProfileValuesIndex != -99) { GaiaUtils.GetRuntimeSceneObject(); if (GaiaGlobal.Instance != null) { GaiaLighting.GetProfile(m_profile, m_gaiaSettings.m_pipelineProfile, m_gaiaSettings.m_pipelineProfile.m_activePipelineInstalled); } } EditorUtility.SetDirty(m_profile); }
public static void ConvertProfileToHDRP(SceneProfile lightingProfile, GaiaLightingProfileValues profile, bool convertToNewProfile = false) { try { if (GaiaUtils.GetActivePipeline() != GaiaConstants.EnvironmentRenderer.HighDefinition) { Debug.Log("Need to be using High Definition render pipeline to use this function"); return; } GaiaLightingProfileValues profileValue = profile; if (convertToNewProfile) { GaiaLightingProfileValues newProfileValues = new GaiaLightingProfileValues(); GaiaUtils.CopyFields(profile, newProfileValues); profileValue = newProfileValues; lightingProfile.m_lightingProfiles.Add(profileValue); profileValue.m_typeOfLighting = "Converted HDRP Profile " + (lightingProfile.m_lightingProfiles.Count - 1); lightingProfile.m_selectedLightingProfileValuesIndex = lightingProfile.m_lightingProfiles.Count - 1; } if (EditorUtility.DisplayDialog("Convert Sun", "Would you like to convert the Sun Values", "Yes", "No")) { ConvertSun(profileValue, GaiaConstants.EnvironmentRenderer.HighDefinition); } //ConvertPWWeather(profileValue, GaiaConstants.EnvironmentRenderer.HighDefinition); } catch (Exception e) { Console.WriteLine(e); throw; } }
public void OnEnable() { //Get Gaia Lighting Profile object m_profile = (GaiaLightingProfile)target; if (m_editorUtils == null) { // Get editor utils for this m_editorUtils = PWApp.GetEditorUtils(this); } if (m_gaiaSettings == null) { m_gaiaSettings = GaiaUtils.GetGaiaSettings(); } m_renderPipeline = m_gaiaSettings.m_pipelineProfile.m_activePipelineInstalled; m_version = PWApp.CONF.Version; if (m_profile != null) { m_profileValues = m_profile.m_lightingProfiles[m_profile.m_selectedLightingProfileValuesIndex]; } enableEditMode = System.IO.Directory.Exists(GaiaUtils.GetAssetPath("Dev Utilities")); }
private void SavePWSkyAtmosphere(GaiaLightingProfileValues profileValues, ProceduralWorldsGlobalWeather globalWeather) { if (profileValues == null || globalWeather == null) { return; } profileValues.m_pwSkyAtmosphereData.TODSkyboxTint = globalWeather.TODSkyboxTint; profileValues.m_pwSkyAtmosphereData.TODSkyboxExposure = globalWeather.TODSkyboxExposure; profileValues.m_pwSkyAtmosphereData.TODSunColor = globalWeather.TODSunColor; profileValues.m_pwSkyAtmosphereData.TODFogColor = globalWeather.TODFogColor; profileValues.m_pwSkyAtmosphereData.TODAmbientSkyColor = globalWeather.TODAmbientSkyColor; profileValues.m_pwSkyAtmosphereData.TODAmbientEquatorColor = globalWeather.TODAmbientEquatorColor; profileValues.m_pwSkyAtmosphereData.TODAmbientGroundColor = globalWeather.TODAmbientGroundColor; profileValues.m_pwSkyAtmosphereData.TODSunIntensity = globalWeather.TODSunIntensity; profileValues.m_pwSkyAtmosphereData.TODSunShadowStrength = globalWeather.TODSunShadowStrength; profileValues.m_pwSkyAtmosphereData.TODCloudHeightLevelDensity = globalWeather.TODCloudHeightLevelDensity; profileValues.m_pwSkyAtmosphereData.TODCloudHeightLevelThickness = globalWeather.TODCloudHeightLevelThickness; profileValues.m_pwSkyAtmosphereData.TODCloudHeightLevelSpeed = globalWeather.TODCloudHeightLevelSpeed; profileValues.m_pwSkyAtmosphereData.TODCloudOpacity = globalWeather.TODCloudOpacity; profileValues.m_pwSkyAtmosphereData.CloudDomeBrightness = globalWeather.CloudDomeBrightness; profileValues.m_pwSkyAtmosphereData.TODAmbientIntensity = globalWeather.TODAmbientIntensity; profileValues.m_pwSkyAtmosphereData.TODAtmosphereThickness = globalWeather.TODAtmosphereThickness; profileValues.m_pwSkyAtmosphereData.TODFogDensity = globalWeather.TODFogDensity; profileValues.m_pwSkyAtmosphereData.TODFogStartDistance = globalWeather.TODFogStartDistance; profileValues.m_pwSkyAtmosphereData.TODFogEndDistance = globalWeather.TODFogEndDistance; profileValues.m_pwSkyAtmosphereData.TODHDRPFogBaseHeight = globalWeather.TODHDRPFogBaseHeight; profileValues.m_pwSkyAtmosphereData.TODHDRPFogAnisotropy = globalWeather.TODHDRPFogAnisotropy; profileValues.m_pwSkyAtmosphereData.TODHDRPFogLightProbeDimmer = globalWeather.TODHDRPFogLightProbeDimmer; profileValues.m_pwSkyAtmosphereData.TODHDRPFogDepthExtent = globalWeather.TODHDRPFogDepthExtent; profileValues.m_pwSkyAtmosphereData.TODHDRPGroundTint = globalWeather.TODHDRPGroundTint; profileValues.m_pwSkyAtmosphereData.TODHDRPFogAlbedo = globalWeather.TODHDRPFogAlbedo; profileValues.m_pwSkyAtmosphereData.TODSunSize = globalWeather.TODSunSize; profileValues.m_pwSkyAtmosphereData.TODSunSizeConvergence = globalWeather.TODSunSizeConvergence; }
private void OnEnable() { //Get Gaia Lighting Profile object m_profile = (GaiaGlobal)target; if (m_editorUtils == null) { // Get editor utils for this m_editorUtils = PWApp.GetEditorUtils(this); } if (m_gaiaSettings == null) { m_gaiaSettings = GaiaUtils.GetGaiaSettings(); } if (m_profile.SceneProfile == null) { m_profile.SceneProfile = ScriptableObject.CreateInstance <SceneProfile>(); } if (m_profile.SceneProfile.m_selectedLightingProfileValuesIndex > m_profile.SceneProfile.m_lightingProfiles.Count - 1) { m_profile.SceneProfile.m_selectedLightingProfileValuesIndex = 1; } if (m_profile.SceneProfile.m_selectedWaterProfileValuesIndex > m_profile.SceneProfile.m_waterProfiles.Count - 1) { m_profile.SceneProfile.m_selectedWaterProfileValuesIndex = 1; } m_profile.SceneProfile.ProfileVersion = PWApp.CONF.Version; #if GAIA_PRO_PRESENT if (ProceduralWorldsGlobalWeather.Instance != null) { LoadSettings(); } #endif if (dropdownGUIStyle == null) { dropdownGUIStyle = new GUIStyle(EditorStyles.popup) { fixedHeight = 16f, margin = new RectOffset(0, 0, 4, 0) }; } if (m_profile.SceneProfile.m_lightingProfiles.Count > 0) { if (m_profile.SceneProfile.m_selectedLightingProfileValuesIndex != -99) { GaiaLightingProfileValues profileValues = m_profile.SceneProfile.m_lightingProfiles[m_profile.SceneProfile.m_selectedLightingProfileValuesIndex]; GaiaSceneManagement.FetchSceneSettigns(m_profile.SceneProfile, profileValues); } } }
private static void ConvertPWWeather(GaiaLightingProfileValues profile, GaiaConstants.EnvironmentRenderer renderPipeline) { ConvertCloudBrightness(profile, renderPipeline); ConvertAmbientIntensity(profile, renderPipeline); ConvertAtmosphereThickness(profile, renderPipeline); ConvertCloudHeightLevelDensity(profile, renderPipeline); ConvertCloudHeightLevelThickness(profile, renderPipeline); ConvertCloudOpacity(profile, renderPipeline); ConvertFogDensity(profile, renderPipeline); ConvertSunIntensity(profile, renderPipeline); }
private static void ConvertSun(GaiaLightingProfileValues profile, GaiaConstants.EnvironmentRenderer renderPipeline) { if (renderPipeline == GaiaConstants.EnvironmentRenderer.Universal) { profile.m_lWSunColor = profile.m_sunColor; profile.m_lWSunIntensity = profile.m_sunIntensity + 0.15f; } else { profile.m_hDSunColor = profile.m_sunColor; profile.m_hDSunIntensity = profile.m_sunIntensity * 3f; } }
private void SavePWSkyWind(GaiaLightingProfileValues profileValues, ProceduralWorldsGlobalWeather globalWeather) { if (profileValues == null || globalWeather == null) { return; } profileValues.m_pwSkyWindData.WindSpeed = globalWeather.WindSpeed; profileValues.m_pwSkyWindData.WindTurbulence = globalWeather.WindTurbulence; profileValues.m_pwSkyWindData.WindFrequency = globalWeather.WindFrequency; profileValues.m_pwSkyWindData.WindDirection = globalWeather.WindDirection; profileValues.m_pwSkyWindData.WindMultiplier = globalWeather.WindMultiplier; }
private void SetPostProcessing(GaiaLightingProfileValues profile) { if (m_gaiaSettings.m_currentRenderer == GaiaConstants.EnvironmentRenderer.BuiltIn) { if (m_profile.m_setupPostFX) { if (profile != null) { GaiaLighting.SetupPostProcessing(profile, m_profile, GaiaUtils.GetActivePipeline(), true); } } } }
private static void ConvertFogDensity(GaiaLightingProfileValues profile, GaiaConstants.EnvironmentRenderer renderPipeline) { if (renderPipeline == GaiaConstants.EnvironmentRenderer.Universal) { //Does not need changing } else { for (int i = 0; i < profile.m_pwSkyAtmosphereData.TODFogDensity.keys.Length; i++) { profile.m_pwSkyAtmosphereData.TODFogDensity.keys[i].value += 0.005f; } } }
private void SavePWSeason(GaiaLightingProfileValues profileValues, ProceduralWorldsGlobalWeather globalWeather) { if (profileValues == null || globalWeather == null) { return; } profileValues.m_pwSkySeasonData.EnableSeasons = globalWeather.EnableSeasons; profileValues.m_pwSkySeasonData.SeasonMode = globalWeather.SeasonMode; profileValues.m_pwSkySeasonData.Season = globalWeather.Season; profileValues.m_pwSkySeasonData.SeasonWinterTint = globalWeather.SeasonWinterTint; profileValues.m_pwSkySeasonData.SeasonSpringTint = globalWeather.SeasonSpringTint; profileValues.m_pwSkySeasonData.SeasonSummerTint = globalWeather.SeasonSummerTint; profileValues.m_pwSkySeasonData.SeasonAutumnTint = globalWeather.SeasonAutumnTint; profileValues.m_pwSkySeasonData.m_seasonTransitionDuration = globalWeather.m_seasonTransitionDuration; }
private static void ConvertSunIntensity(GaiaLightingProfileValues profile, GaiaConstants.EnvironmentRenderer renderPipeline) { if (renderPipeline == GaiaConstants.EnvironmentRenderer.Universal) { for (int i = 0; i < profile.m_pwSkyAtmosphereData.TODSunIntensity.keys.Length; i++) { profile.m_pwSkyAtmosphereData.TODSunIntensity.keys[i].value += 0.06f; } } else { for (int i = 0; i < profile.m_pwSkyAtmosphereData.TODSunIntensity.keys.Length; i++) { profile.m_pwSkyAtmosphereData.TODSunIntensity.keys[i].value *= 3f; } } }
private static void ConvertCloudHeightLevelThickness(GaiaLightingProfileValues profile, GaiaConstants.EnvironmentRenderer renderPipeline) { if (renderPipeline == GaiaConstants.EnvironmentRenderer.Universal) { for (int i = 0; i < profile.m_pwSkyAtmosphereData.TODCloudHeightLevelThickness.keys.Length; i++) { profile.m_pwSkyAtmosphereData.TODCloudHeightLevelThickness.keys[i].value += 0.1f; } } else { for (int i = 0; i < profile.m_pwSkyAtmosphereData.TODCloudHeightLevelThickness.keys.Length; i++) { profile.m_pwSkyAtmosphereData.TODCloudHeightLevelThickness.keys[i].value += 0.125f; } } }
/// <summary> /// Sets the sun intensity /// </summary> /// <param name="profile"></param> /// <param name="volumeProfile"></param> public static void SetSunSettings(GaiaLightingProfileValues profile) { try { Light light = GaiaUtils.GetMainDirectionalLight(); if (light != null) { light.color = profile.m_lWSunColor; light.intensity = profile.m_lWSunIntensity; } } catch (Exception e) { Console.WriteLine(e); throw; } }
/// <summary> /// Syncs user HDRP profiles settings to the source. /// </summary> public static void SyncUserHDRPEnvironmentProfile() { if (GaiaGlobal.Instance.SceneProfile == null) { return; } GameObject volumeEnvironment = GameObject.Find(GaiaConstants.HDRPEnvironmentObject); if (volumeEnvironment != null) { #if HDPipeline Volume volume = volumeEnvironment.GetComponent <Volume>(); if (volume != null) { VolumeProfile sceneVolumeProfile = volume.sharedProfile; GaiaLightingProfileValues lightingProfileValues = GaiaGlobal.Instance.SceneProfile.m_lightingProfiles[GaiaGlobal.Instance.SceneProfile.m_selectedLightingProfileValuesIndex]; if (lightingProfileValues != null) { if (lightingProfileValues.m_userCustomProfile) { VolumeProfile gaialightVolumeProfile = lightingProfileValues.EnvironmentProfileHDRP; if (gaialightVolumeProfile != null) { SyncHDRPVisualEnvironment(sceneVolumeProfile, gaialightVolumeProfile); SyncHDRPGradientSky(sceneVolumeProfile, gaialightVolumeProfile); SyncHDRPHDRISky(sceneVolumeProfile, gaialightVolumeProfile); SyncHDRPPhysicallyBasedSky(sceneVolumeProfile, gaialightVolumeProfile); SyncHDRPFog(sceneVolumeProfile, gaialightVolumeProfile); SyncHDRPShadows(sceneVolumeProfile, gaialightVolumeProfile); SyncHDRPContactShadows(sceneVolumeProfile, gaialightVolumeProfile); SyncHDRPMicroShadows(sceneVolumeProfile, gaialightVolumeProfile); SyncHDRPAmbientLight(sceneVolumeProfile, gaialightVolumeProfile); } #if UNITY_EDITOR UnityEditor.EditorUtility.SetDirty(gaialightVolumeProfile); #endif } } } #endif } }
private void SavePWSkyWeather(GaiaLightingProfileValues profileValues, ProceduralWorldsGlobalWeather globalWeather) { if (profileValues == null || globalWeather == null) { return; } profileValues.m_pwSkyWeatherData.m_weatherFadeDuration = globalWeather.m_weatherFadeDuration; profileValues.m_pwSkyWeatherData.m_modifyFog = globalWeather.m_modifyFog; profileValues.m_pwSkyWeatherData.m_modifyWind = globalWeather.m_modifyWind; profileValues.m_pwSkyWeatherData.m_modifySkybox = globalWeather.m_modifySkybox; profileValues.m_pwSkyWeatherData.m_modifyPostProcessing = globalWeather.m_modifyPostProcessing; profileValues.m_pwSkyWeatherData.m_modifySun = globalWeather.m_modifySun; profileValues.m_pwSkyWeatherData.m_modifyAmbient = globalWeather.m_modifyAmbient; profileValues.m_pwSkyWeatherData.m_modifyClouds = globalWeather.m_modifyClouds; profileValues.m_pwSkyWeatherData.m_rainSettings.EnableRain = globalWeather.EnableRain; profileValues.m_pwSkyWeatherData.m_rainSettings.RainIntensity = globalWeather.RainIntensity; profileValues.m_pwSkyWeatherData.m_rainSettings.m_rainMode = globalWeather.m_rainMode; profileValues.m_pwSkyWeatherData.m_rainSettings.m_rainHeight = globalWeather.m_rainHeight; profileValues.m_pwSkyWeatherData.m_rainSettings.m_rainStepSize = globalWeather.m_rainStepSize; GaiaUtils.CopyFields(globalWeather.m_rainWeatherSettings, profileValues.m_pwSkyWeatherData.m_rainSettings.m_rainWeatherSettings); profileValues.m_pwSkyWeatherData.m_snowSettings.EnableSnow = globalWeather.EnableSnow; profileValues.m_pwSkyWeatherData.m_snowSettings.SnowCoverAlwaysEnabled = globalWeather.SnowCoverAlwaysEnabled; profileValues.m_pwSkyWeatherData.m_snowSettings.SnowIntensity = globalWeather.SnowIntensity; profileValues.m_pwSkyWeatherData.m_snowSettings.SnowHeight = globalWeather.SnowHeight; profileValues.m_pwSkyWeatherData.m_snowSettings.PermanentSnowHeight = globalWeather.PermanentSnowHeight; profileValues.m_pwSkyWeatherData.m_snowSettings.SnowingHeight = globalWeather.SnowingHeight; profileValues.m_pwSkyWeatherData.m_snowSettings.SnowFadeHeight = globalWeather.SnowFadeHeight; profileValues.m_pwSkyWeatherData.m_snowSettings.m_snowStormChance = globalWeather.m_snowStormChance; profileValues.m_pwSkyWeatherData.m_snowSettings.m_snowStepSize = globalWeather.m_snowStepSize; profileValues.m_pwSkyWeatherData.m_snowSettings.m_snowMode = globalWeather.m_snowMode; GaiaUtils.CopyFields(globalWeather.m_snowWeatherSettings, profileValues.m_pwSkyWeatherData.m_snowSettings.m_snowWeatherSettings); profileValues.m_pwSkyWeatherData.m_thunderSettings.m_enableThunder = globalWeather.m_enableThunder; profileValues.m_pwSkyWeatherData.m_thunderSettings.ThunderWaitDuration = globalWeather.ThunderWaitDuration; profileValues.m_pwSkyWeatherData.m_thunderSettings.m_thunderChance = globalWeather.m_thunderChance; profileValues.m_pwSkyWeatherData.m_thunderSettings.ThunderLightColor = globalWeather.ThunderLightColor; profileValues.m_pwSkyWeatherData.m_thunderSettings.ThunderLightIntensity = globalWeather.ThunderLightIntensity; profileValues.m_pwSkyWeatherData.m_thunderSettings.ThunderAudioSources = globalWeather.ThunderAudioSources; profileValues.m_pwSkyWeatherData.m_thunderSettings.ThunderLightRadius = globalWeather.ThunderLightRadius; }
/// <summary> /// Sets the sun intensity /// </summary> /// <param name="profile"></param> /// <param name="volumeProfile"></param> public static void SetSunSettings(Light light, GaiaLightingProfileValues profile) { if (light == null) { light = GetSunLight(); } if (profile.m_useKelvin) { profile.m_lWSunColor = GaiaUtils.ExecuteKelvinColor(profile.m_kelvinValue); } if (light != null) { light.color = profile.m_lWSunColor; light.intensity = profile.m_lWSunIntensity; light.shadows = profile.m_shadowCastingMode; light.shadowStrength = profile.m_shadowStrength; light.shadowResolution = profile.m_sunShadowResolution; } }
private void SavePWSkyCloud(GaiaLightingProfileValues profileValues, ProceduralWorldsGlobalWeather globalWeather) { if (profileValues == null || globalWeather == null) { return; } profileValues.m_pwSkyCloudData.EnableClouds = globalWeather.EnableClouds; profileValues.m_pwSkyCloudData.CloudHeight = globalWeather.CloudHeight; profileValues.m_pwSkyCloudData.CloudAmbientColor = globalWeather.CloudAmbientColor; profileValues.m_pwSkyCloudData.CloudScale = globalWeather.CloudScale; profileValues.m_pwSkyCloudData.CloudOffset = globalWeather.CloudOffset; profileValues.m_pwSkyCloudData.CloudBrightness = globalWeather.CloudBrightness; profileValues.m_pwSkyCloudData.CloudFade = globalWeather.CloudFade; profileValues.m_pwSkyCloudData.CloudTilingAndWind = globalWeather.CloudTilingAndWind; profileValues.m_pwSkyCloudData.CloudOpacity = globalWeather.CloudOpacity; profileValues.m_pwSkyCloudData.CloudRotationSpeedLow = globalWeather.CloudRotationSpeedLow; profileValues.m_pwSkyCloudData.CloudRotationSpeedMiddle = globalWeather.CloudRotationSpeedMiddle; profileValues.m_pwSkyCloudData.CloudRotationSpeedFar = globalWeather.CloudRotationSpeedFar; }
public void SaveToGaiaDefault(GaiaLightingProfileValues profileValues, ProceduralWorldsGlobalWeather globalWeather) { if (profileValues == null) { return; } GaiaLightingProfileValues newProfileValues = new GaiaLightingProfileValues(); GaiaUtils.CopyFields(profileValues, newProfileValues); newProfileValues.m_userCustomProfile = false; #if UNITY_POST_PROCESSING_STACK_V2 newProfileValues.PostProcessProfileBuiltIn = profileValues.PostProcessProfileBuiltIn; newProfileValues.m_postProcessingProfileGUIDBuiltIn = profileValues.m_postProcessingProfileGUIDBuiltIn; #endif #if UPPipeline newProfileValues.PostProcessProfileURP = profileValues.PostProcessProfileURP; newProfileValues.m_postProcessingProfileGUIDURP = profileValues.m_postProcessingProfileGUIDURP; #endif #if HDPipeline newProfileValues.PostProcessProfileHDRP = profileValues.PostProcessProfileHDRP; newProfileValues.m_postProcessingProfileGUIDHDRP = profileValues.m_postProcessingProfileGUIDHDRP; newProfileValues.EnvironmentProfileHDRP = profileValues.EnvironmentProfileHDRP; newProfileValues.m_environmentProfileGUIDHDRP = profileValues.m_environmentProfileGUIDHDRP; #endif GaiaSettings gaiaSettings = GaiaUtils.GetGaiaSettings(); if (gaiaSettings != null) { GaiaLightingProfile lightingProfile = gaiaSettings.m_gaiaLightingProfile; if (lightingProfile != null) { bool addProfile = true; int indexForReplacement = 0; for (int i = 0; i < lightingProfile.m_lightingProfiles.Count; i++) { if (lightingProfile.m_lightingProfiles[i].m_typeOfLighting == newProfileValues.m_typeOfLighting) { addProfile = false; indexForReplacement = i; } } if (addProfile) { SavePWSkyAtmosphere(newProfileValues, globalWeather); SavePWSeason(newProfileValues, globalWeather); SavePWSkyCloud(newProfileValues, globalWeather); SavePWSkyWeather(newProfileValues, globalWeather); SavePWSkyWind(newProfileValues, globalWeather); SaveColorAndCubemapFields(newProfileValues, profileValues); lightingProfile.m_lightingProfiles.Add(newProfileValues); } else { #if UNITY_EDITOR if (EditorUtility.DisplayDialog("Profile Already Exists", "This profile " + newProfileValues.m_typeOfLighting + " already exists the the default Gaia lighting profile. Do you want to replace this profile?", "Yes", "No")) { GaiaUtils.CopyFields(newProfileValues, lightingProfile.m_lightingProfiles[indexForReplacement]); SavePWSkyAtmosphere(lightingProfile.m_lightingProfiles[indexForReplacement], globalWeather); SavePWSeason(lightingProfile.m_lightingProfiles[indexForReplacement], globalWeather); SavePWSkyCloud(lightingProfile.m_lightingProfiles[indexForReplacement], globalWeather); SavePWSkyWeather(lightingProfile.m_lightingProfiles[indexForReplacement], globalWeather); SavePWSkyWind(lightingProfile.m_lightingProfiles[indexForReplacement], globalWeather); SaveColorAndCubemapFields(lightingProfile.m_lightingProfiles[indexForReplacement], profileValues); #if UNITY_POST_PROCESSING_STACK_V2 lightingProfile.m_lightingProfiles[indexForReplacement].PostProcessProfileBuiltIn = profileValues.PostProcessProfileBuiltIn; lightingProfile.m_lightingProfiles[indexForReplacement].m_postProcessingProfileGUIDBuiltIn = profileValues.m_postProcessingProfileGUIDBuiltIn; #endif #if UPPipeline lightingProfile.m_lightingProfiles[indexForReplacement].PostProcessProfileURP = profileValues.PostProcessProfileURP; lightingProfile.m_lightingProfiles[indexForReplacement].m_postProcessingProfileGUIDURP = profileValues.m_postProcessingProfileGUIDURP; #endif #if HDPipeline lightingProfile.m_lightingProfiles[indexForReplacement].PostProcessProfileHDRP = profileValues.PostProcessProfileHDRP; lightingProfile.m_lightingProfiles[indexForReplacement].m_postProcessingProfileGUIDHDRP = profileValues.m_postProcessingProfileGUIDHDRP; #endif } #endif } #if UNITY_EDITOR EditorUtility.SetDirty(lightingProfile); #endif Debug.Log("Profile successfully added to the Gaia Lighting Profile. Remember to save your project to save the changes"); } } }
/// <summary> /// Crate post processing instance profile /// </summary> /// <param name="sceneProfile"></param> public static void CreatePostFXProfileInstance(SceneProfile sceneProfile, GaiaLightingProfileValues profile) { try { if (sceneProfile == null) { return; } #if UPPipeline VolumeProfile volumeProfile = AssetDatabase.LoadAssetAtPath <VolumeProfile>(GaiaUtils.GetAssetPath("URP Global Post Processing Profile.asset")); if (profile.PostProcessProfileURP != null) { volumeProfile = profile.PostProcessProfileURP; } if (volumeProfile == null) { return; } GaiaSessionManager session = GaiaSessionManager.GetSessionManager(); if (session != null) { string path = GaiaDirectories.GetSceneProfilesFolderPath(session.m_session); if (!string.IsNullOrEmpty(path)) { if (EditorSceneManager.GetActiveScene() != null) { if (!string.IsNullOrEmpty(EditorSceneManager.GetActiveScene().path)) { path = path + "/" + EditorSceneManager.GetActiveScene().name + " " + volumeProfile.name + " Profile.asset"; } else { path = path + "/" + volumeProfile.name + " HDRP Post FX Profile.asset"; } } else { path = path + "/" + volumeProfile.name + " HDRP Post FX Profile.asset"; } if (sceneProfile.m_universalPostFXProfile != null) { if (!sceneProfile.m_isUserProfileSet) { if (!sceneProfile.m_universalPostFXProfile.name.Contains(volumeProfile.name)) { AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(sceneProfile.m_universalPostFXProfile)); sceneProfile.m_universalPostFXProfile = null; } } } if (AssetDatabase.LoadAssetAtPath <VolumeProfile>(path) == null) { FileUtil.CopyFileOrDirectory(AssetDatabase.GetAssetPath(volumeProfile), path); AssetDatabase.ImportAsset(path); } sceneProfile.m_universalPostFXProfile = AssetDatabase.LoadAssetAtPath <VolumeProfile>(path); } } #endif } catch (Exception e) { Console.WriteLine(e); throw; } }
/// <summary> /// Apply URP post fx /// </summary> /// <param name="profile"></param> /// <param name="lightingProfile"></param> public static GameObject ApplyURPPostProcessing(GaiaLightingProfileValues profile, SceneProfile lightingProfile) { try { GameObject volumeObject = null; #if UPPipeline if (lightingProfile.m_enablePostProcessing) { volumeObject = GameObject.Find("Global Post Processing"); if (volumeObject == null) { volumeObject = new GameObject("Global Post Processing"); } GameObject parentObject = GaiaLighting.GetOrCreateParentObject(GaiaConstants.gaiaLightingObject, true); if (parentObject != null) { volumeObject.transform.SetParent(parentObject.transform); } volumeObject.layer = 0; Volume volume = volumeObject.GetComponent <Volume>(); if (volume == null) { volume = volumeObject.AddComponent <Volume>(); } if (GaiaGlobal.Instance != null) { SceneProfile sceneProfile = GaiaGlobal.Instance.SceneProfile; if (sceneProfile != null) { if (sceneProfile.m_lightingEditSettings || profile.m_userCustomProfile) { sceneProfile.m_universalPostFXProfile = profile.PostProcessProfileURP; } else { CreatePostFXProfileInstance(sceneProfile, profile); } volume.sharedProfile = sceneProfile.m_universalPostFXProfile; Camera camera = GaiaUtils.GetCamera(); if (camera != null) { UniversalAdditionalCameraData cameraData = camera.GetComponent <UniversalAdditionalCameraData>(); if (cameraData == null) { cameraData = camera.gameObject.AddComponent <UniversalAdditionalCameraData>(); } cameraData.renderPostProcessing = true; GaiaLighting.ConfigureAntiAliasing(sceneProfile, GaiaConstants.EnvironmentRenderer.Universal); } } } } else { volumeObject = GameObject.Find("Global Post Processing"); if (volumeObject != null) { GameObject.DestroyImmediate(volumeObject); } Camera camera = GaiaUtils.GetCamera(); if (camera != null) { UniversalAdditionalCameraData cameraData = camera.GetComponent <UniversalAdditionalCameraData>(); if (cameraData == null) { cameraData = camera.gameObject.AddComponent <UniversalAdditionalCameraData>(); } cameraData.renderPostProcessing = false; } } #endif #if UNITY_POST_PROCESSING_STACK_V2 PostProcessLayer postProcessLayer = GameObject.FindObjectOfType <PostProcessLayer>(); if (postProcessLayer != null) { GameObject.DestroyImmediate(postProcessLayer); } PostProcessVolume postProcessVolume = GameObject.FindObjectOfType <PostProcessVolume>(); if (postProcessVolume != null) { GameObject.DestroyImmediate(postProcessVolume); } #endif return(volumeObject); } catch (Exception e) { Console.WriteLine(e); throw; } }
private void GlobalSettings(bool helpEnabled) { if (GaiaGlobal.Instance.SceneProfile.m_lightingProfiles.Count > 0) { if (m_profile.m_selectedLightingProfileValuesIndex != -99) { profile = GaiaGlobal.Instance.SceneProfile.m_lightingProfiles[m_profile.m_selectedLightingProfileValuesIndex]; } } if (m_gaiaSettings.m_currentRenderer == GaiaConstants.EnvironmentRenderer.BuiltIn) { bool postfx = m_profile.m_setupPostFX; m_profile.m_setupPostFX = m_editorUtils.Toggle("SetupPostFX", m_profile.m_setupPostFX, helpEnabled); if (postfx != m_profile.m_setupPostFX) { if (m_profile.m_setupPostFX) { if (profile != null) { GaiaLighting.SetupPostProcessing(profile, m_profile, GaiaUtils.GetActivePipeline(), true); } } else { GaiaLighting.RemoveAllPostProcessV2CameraLayer(); } } } m_profile.m_spawnPlayerAtCurrentLocation = m_editorUtils.Toggle("SpawnPlayerAtCurrentLocation", m_profile.m_spawnPlayerAtCurrentLocation, helpEnabled); GaiaConstants.EnvironmentControllerType controller = m_profile.m_controllerType; controller = (GaiaConstants.EnvironmentControllerType)m_editorUtils.EnumPopup("ControllerType", controller, helpEnabled); if (controller != m_profile.m_controllerType) { m_gaiaSettings.m_currentController = controller; switch (controller) { case GaiaConstants.EnvironmentControllerType.FirstPerson: GaiaSceneManagement.CreatePlayer(m_gaiaSettings, GaiaConstants.playerFirstPersonName, m_profile.m_spawnPlayerAtCurrentLocation, null, null, true); break; case GaiaConstants.EnvironmentControllerType.FlyingCamera: GaiaSceneManagement.CreatePlayer(m_gaiaSettings, GaiaConstants.playerFlyCamName, m_profile.m_spawnPlayerAtCurrentLocation, null, null, true); break; case GaiaConstants.EnvironmentControllerType.ThirdPerson: GaiaSceneManagement.CreatePlayer(m_gaiaSettings, GaiaConstants.playerThirdPersonName, m_profile.m_spawnPlayerAtCurrentLocation, null, null, true); break; case GaiaConstants.EnvironmentControllerType.Car: GaiaSceneManagement.CreatePlayer(m_gaiaSettings, GaiaConstants.m_carPlayerPrefabName, m_profile.m_spawnPlayerAtCurrentLocation, null, null, true); break; case GaiaConstants.EnvironmentControllerType.XRController: #if GAIA_XR GaiaSceneManagement.CreatePlayer(m_gaiaSettings, "XRController", m_profile.m_spawnPlayerAtCurrentLocation); #else EditorUtility.DisplayDialog("XR Support not enabled", "The XR Controller is a default player for Virtual / Augmented Reality projects. Please open the Setup Panel in the Gaia Manager Standard Tab to enable XR Support in order to use the XR Player Controller. Please also make sure you have the Unity XR Interaction Toolkit package installed before doing so.", "OK"); controller = GaiaConstants.EnvironmentControllerType.FlyingCamera; m_gaiaSettings.m_currentController = GaiaConstants.EnvironmentControllerType.FlyingCamera; #endif break; } SetPostProcessing(profile); #if GAIA_PRO_PRESENT if (GaiaUtils.HasDynamicLoadedTerrains()) { TerrainLoader tl = ((GaiaScenePlayer)target).GetComponentInChildren <TerrainLoader>(); if (tl != null) { m_profile.UpdateTerrainLoaderFromProfile(ref tl); } } #endif m_profile.m_controllerType = controller; } if (controller == GaiaConstants.EnvironmentControllerType.Custom) { m_profile.m_customPlayer = (GameObject)m_editorUtils.ObjectField("MainPlayer", m_profile.m_customPlayer, typeof(GameObject), true, helpEnabled); m_profile.m_customCamera = (Camera)m_editorUtils.ObjectField("MainCamera", m_profile.m_customCamera, typeof(Camera), true, helpEnabled); if (m_editorUtils.Button("ApplySetup")) { GaiaSceneManagement.CreatePlayer(m_gaiaSettings, "Custom", m_profile.m_spawnPlayerAtCurrentLocation, m_profile.m_customPlayer, m_profile.m_customCamera, true); SetPostProcessing(profile); #if GAIA_PRO_PRESENT if (GaiaUtils.HasDynamicLoadedTerrains()) { TerrainLoader tl = ((GaiaScenePlayer)target).GetComponentInChildren <TerrainLoader>(); if (tl != null) { m_profile.UpdateTerrainLoaderFromProfile(ref tl); } } #endif } } EditorGUILayout.BeginHorizontal(); if (m_editorUtils.Button("MoveCameraToPlayer")) { GaiaSceneManagement.MoveCameraToPlayer(m_gaiaSettings); } if (m_editorUtils.Button("MovePlayerToCamera")) { GaiaSceneManagement.MovePlayerToCamera(m_gaiaSettings); } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); m_editorUtils.Panel("AutoDepthOfFieldSettings", AutoDepthOfField); m_editorUtils.Panel("LocationManagerSettings", LocationManagerSettings); m_editorUtils.Panel("PlayerCameraCullingSettings", CameraCullingSettings); if (GaiaUtils.HasDynamicLoadedTerrains()) { m_editorUtils.Panel("TerrainLoadingSettings", TerrainLoadingSettings); } }
/// <summary> /// Sets the shadow distance in URP /// </summary> /// <param name="pipelineAsset"></param> /// <param name="profileValues"></param> public static void SetShadowDistance(UniversalRenderPipelineAsset pipelineAsset, GaiaLightingProfileValues profileValues) { if (pipelineAsset == null || profileValues == null) { return; } pipelineAsset.shadowDistance = profileValues.m_shadowDistance; }
private void LightingProfileSettingsEnabled(bool helpEnabled) { //Building up a value array of incrementing ints of the size of the lighting profile values array, this array will then match the displayed string selection in the popup int[] lightingProfileValuesIndices = Enumerable .Repeat(0, (int)((m_profile.m_lightingProfiles.Count - 1) / 1) + 1) .Select((tr, ti) => tr + (1 * ti)) .ToArray(); string[] profileNames = m_profile.m_lightingProfiles.Select(x => x.m_typeOfLighting).ToArray(); //Injecting the "None" option lightingProfileValuesIndices = GaiaUtils.AddElementToArray(lightingProfileValuesIndices, -99); profileNames = GaiaUtils.AddElementToArray(profileNames, "None"); EditorGUILayout.BeginHorizontal(); if (m_profile.m_renamingProfile) { m_profileValues.m_profileRename = m_editorUtils.TextField("NewProfileName", m_profileValues.m_profileRename); } else { m_profile.m_selectedLightingProfileValuesIndex = EditorGUILayout.IntPopup("Lighting Profile", m_profile.m_selectedLightingProfileValuesIndex, profileNames, lightingProfileValuesIndices); } #if !GAIA_PRO_PRESENT bool currentGUIState = GUI.enabled; if (m_profileValues.m_profileType == GaiaConstants.GaiaLightingProfileType.ProceduralWorldsSky) { GUI.enabled = false; } #endif if (m_profile.m_selectedLightingProfileValuesIndex != -99) { m_profileValues = m_profile.m_lightingProfiles[m_profile.m_selectedLightingProfileValuesIndex]; m_profileValues.m_ambientMode = RenderSettings.ambientMode; } if (m_profileValues.m_userCustomProfile) { if (m_profile.m_renamingProfile) { if (m_editorUtils.Button("Save", GUILayout.MaxWidth(55f))) { m_profileValues.m_typeOfLighting = m_profileValues.m_profileRename; m_profile.m_renamingProfile = false; } } else { if (m_editorUtils.Button("Rename", GUILayout.MaxWidth(55f))) { m_profile.m_renamingProfile = true; m_profileValues.m_profileRename = m_profileValues.m_typeOfLighting; } } if (m_editorUtils.Button("Remove", GUILayout.MaxWidth(30f))) { m_profile.m_renamingProfile = false; m_profile.m_lightingProfiles.RemoveAt(m_profile.m_selectedLightingProfileValuesIndex); m_profile.m_selectedLightingProfileValuesIndex--; } } if (m_editorUtils.Button("MakeCopy", GUILayout.MaxWidth(30f))) { AddNewCustomProfile(); } EditorGUILayout.EndHorizontal(); if (m_profile.m_selectedLightingProfileValuesIndex == -99) { EditorGUILayout.HelpBox("No Profile selected. Select another profile that is not 'None' to view settings to edit", MessageType.Info); } else { if (!m_profileValues.m_userCustomProfile) { m_profile.m_renamingProfile = false; EditorGUILayout.HelpBox("This is one of the default Gaia lighting profiles. To create your own please press the '+' button to create a copy from the current selected profile.", MessageType.Info); GUI.enabled = false; } if (m_profile.m_editSettings) { GUI.enabled = true; } if (m_renderPipeline != GaiaConstants.EnvironmentRenderer.HighDefinition) { if (m_profile.m_enablePostProcessing) { m_editorUtils.Heading("PostProcessingSettings"); if (m_renderPipeline == GaiaConstants.EnvironmentRenderer.Universal) { #if UPPipeline m_profileValues.PostProcessProfileURP = (VolumeProfile)m_editorUtils.ObjectField("PostProcessingProfile", m_profileValues.PostProcessProfileURP, typeof(VolumeProfile), false); #endif } else { #if UNITY_POST_PROCESSING_STACK_V2 m_profileValues.PostProcessProfileBuiltIn = (PostProcessProfile)m_editorUtils.ObjectField("PostProcessingProfile", m_profileValues.PostProcessProfileBuiltIn, typeof(PostProcessProfile), false); m_profileValues.m_directToCamera = m_editorUtils.Toggle("DirectToCamera", m_profileValues.m_directToCamera); #else EditorGUILayout.HelpBox("Post Processing is not installed. Install it from the package manager to use the post processing setup features.", MessageType.Info); #endif } GUILayout.Space(20f); } if (m_profileValues.m_profileType == GaiaConstants.GaiaLightingProfileType.ProceduralWorldsSky) { //m_profileValues.m_sunRotation = m_editorUtils.Slider("SunRotation", m_profileValues.m_sunRotation, 0f, 90f); } if (m_profileValues.m_profileType != GaiaConstants.GaiaLightingProfileType.ProceduralWorldsSky) { m_editorUtils.Heading("SunSettings"); m_profileValues.m_sunRotation = m_editorUtils.Slider("SunRotation", m_profileValues.m_sunRotation, 0f, 360f); m_profileValues.m_sunPitch = m_editorUtils.Slider("SunPitch", m_profileValues.m_sunPitch, 0f, 360f); if (m_renderPipeline == GaiaConstants.EnvironmentRenderer.BuiltIn) { m_profileValues.m_sunColor = m_editorUtils.ColorField("SunColor", m_profileValues.m_sunColor); m_profileValues.m_sunIntensity = m_editorUtils.FloatField("SunIntensity", m_profileValues.m_sunIntensity); } else { m_profileValues.m_lWSunColor = m_editorUtils.ColorField("SunColor", m_profileValues.m_lWSunColor); m_profileValues.m_lWSunIntensity = m_editorUtils.FloatField("SunIntensity", m_profileValues.m_lWSunIntensity); } GUILayout.Space(20f); } m_editorUtils.Heading("ShadowSettings"); m_profileValues.m_shadowCastingMode = (LightShadows)EditorGUILayout.EnumPopup("Sun Shadow Casting Mode", m_profileValues.m_shadowCastingMode); if (m_profileValues.m_profileType != GaiaConstants.GaiaLightingProfileType.ProceduralWorldsSky) { m_profileValues.m_shadowStrength = m_editorUtils.Slider("SunShadowStrength", m_profileValues.m_shadowStrength, 0f, 1f, helpEnabled); } m_profileValues.m_shadowDistance = m_editorUtils.Slider("ShadowDistance", m_profileValues.m_shadowDistance, 0f, 10000f, helpEnabled); m_profileValues.m_sunShadowResolution = (LightShadowResolution)EditorGUILayout.EnumPopup("Sun Shadow Resolution", m_profileValues.m_sunShadowResolution); GUILayout.Space(20f); m_editorUtils.Heading("SkyboxSettings"); #if !GAIA_PRO_PRESENT if (m_profileValues.m_profileType == GaiaConstants.GaiaLightingProfileType.ProceduralWorldsSky && m_profileValues.m_userCustomProfile) { GUI.enabled = true; } #endif m_profileValues.m_profileType = (GaiaConstants.GaiaLightingProfileType)m_editorUtils.EnumPopup("SkyboxType", m_profileValues.m_profileType, helpEnabled); #if !GAIA_PRO_PRESENT if (m_profileValues.m_profileType == GaiaConstants.GaiaLightingProfileType.ProceduralWorldsSky) { GUI.enabled = true; EditorGUILayout.HelpBox("The 'Procedural Worlds Sky' profile sky type is available in Gaia Pro only, please choose a different profile type.", MessageType.Info); GUI.enabled = false; } #endif if (m_profileValues.m_profileType == GaiaConstants.GaiaLightingProfileType.Procedural) { m_profileValues.m_sunSize = m_editorUtils.Slider("SunSize", m_profileValues.m_sunSize, 0f, 1f); m_profileValues.m_sunConvergence = m_editorUtils.Slider("SunConvergence", m_profileValues.m_sunConvergence, 0f, 10f); m_profileValues.m_atmosphereThickness = m_editorUtils.Slider("AtmosphereThickness", m_profileValues.m_atmosphereThickness, 0f, 5f); m_profileValues.m_skyboxExposure = m_editorUtils.Slider("SkyboxExposure", m_profileValues.m_skyboxExposure, 0f, 8f); m_profileValues.m_skyboxTint = m_editorUtils.ColorField("SkyboxTint", m_profileValues.m_skyboxTint); m_profileValues.m_groundColor = m_editorUtils.ColorField("GroundColor", m_profileValues.m_groundColor); } else if (m_profileValues.m_profileType == GaiaConstants.GaiaLightingProfileType.HDRI) { m_profileValues.m_skyboxHDRI = (Cubemap)m_editorUtils.ObjectField("HDRISkybox", m_profileValues.m_skyboxHDRI, typeof(Cubemap), false, GUILayout.Height(16f)); m_profileValues.m_skyboxTint = m_editorUtils.ColorField("SkyboxTint", m_profileValues.m_skyboxTint); m_profileValues.m_skyboxExposure = m_editorUtils.Slider("SkyboxExposure", m_profileValues.m_skyboxExposure, 0f, 8f); } GUILayout.Space(20f); //m_profileValues.m_ambientMode = (AmbientMode)EditorGUILayout.EnumPopup("Ambient Mode", m_profileValues.m_ambientMode); if (m_profileValues.m_profileType != GaiaConstants.GaiaLightingProfileType.ProceduralWorldsSky) { m_editorUtils.Heading("AmbientSettings"); m_profileValues.m_ambientMode = (AmbientMode)m_editorUtils.EnumPopup("AmbientMode", m_profileValues.m_ambientMode, helpEnabled); if (RenderSettings.ambientMode == AmbientMode.Skybox) { m_profileValues.m_ambientIntensity = m_editorUtils.Slider("AmbientIntensity", m_profileValues.m_ambientIntensity, 0f, 10f); } else if (RenderSettings.ambientMode == AmbientMode.Flat) { m_profileValues.m_skyAmbient = m_editorUtils.ColorField("SkyAmbient", m_profileValues.m_skyAmbient); } else if (RenderSettings.ambientMode == AmbientMode.Trilight) { m_profileValues.m_skyAmbient = m_editorUtils.ColorField("SkyAmbient", m_profileValues.m_skyAmbient); m_profileValues.m_equatorAmbient = m_editorUtils.ColorField("EquatorAmbient", m_profileValues.m_equatorAmbient); m_profileValues.m_groundAmbient = m_editorUtils.ColorField("GroundAmbient", m_profileValues.m_groundAmbient); } GUILayout.Space(20f); } if (m_profile.m_enableFog) { m_editorUtils.Heading("FogSettings"); m_profileValues.m_fogMode = (FogMode)EditorGUILayout.EnumPopup("Fog Mode", m_profileValues.m_fogMode); if (m_profileValues.m_profileType != GaiaConstants.GaiaLightingProfileType.ProceduralWorldsSky) { if (m_profileValues.m_fogMode == FogMode.Linear) { m_profileValues.m_fogColor = m_editorUtils.ColorField("FogColor", m_profileValues.m_fogColor); m_profileValues.m_fogStartDistance = m_editorUtils.FloatField("FogStartDistance", m_profileValues.m_fogStartDistance); m_profileValues.m_fogEndDistance = m_editorUtils.FloatField("FogEndDistance", m_profileValues.m_fogEndDistance); } else { m_profileValues.m_fogColor = m_editorUtils.ColorField("FogColor", m_profileValues.m_fogColor); m_profileValues.m_fogDensity = m_editorUtils.Slider("FogDensity", m_profileValues.m_fogDensity, 0f, 1f); } } } } else { m_profileValues.m_profileType = (GaiaConstants.GaiaLightingProfileType)m_editorUtils.EnumPopup("SkyboxType", m_profileValues.m_profileType, helpEnabled); if (m_profile.m_enablePostProcessing) { m_editorUtils.Heading("PostProcessingSettings"); EditorGUI.indentLevel++; #if HDPipeline m_profileValues.PostProcessProfileHDRP = (VolumeProfile)m_editorUtils.ObjectField("PostProcessingProfile", m_profileValues.PostProcessProfileHDRP, typeof(VolumeProfile), false); #endif EditorGUI.indentLevel--; GUILayout.Space(20f); } #if GAIA_PRO_PRESENT if (m_profile.m_enableAmbientAudio) { m_editorUtils.Heading("AmbientAudioSettings"); EditorGUI.indentLevel++; m_profileValues.m_ambientVolume = m_editorUtils.Slider("AmbientAudioVolume", m_profileValues.m_ambientVolume, 0f, 1f, helpEnabled); m_profileValues.m_ambientAudio = (AudioClip)m_editorUtils.ObjectField("AmbientAudioClip", m_profileValues.m_ambientAudio, typeof(AudioClip), false, helpEnabled); EditorGUI.indentLevel--; GUILayout.Space(20f); } #endif if (m_profileValues.m_profileType != GaiaConstants.GaiaLightingProfileType.ProceduralWorldsSky) { m_editorUtils.Heading("SunSettings"); EditorGUI.indentLevel++; m_profileValues.m_sunRotation = m_editorUtils.Slider("SunRotation", m_profileValues.m_sunRotation, 0f, 360f); m_profileValues.m_sunPitch = m_editorUtils.Slider("SunPitch", m_profileValues.m_sunPitch, 0f, 360f); m_profileValues.m_hDSunColor = m_editorUtils.ColorField("SunColor", m_profileValues.m_hDSunColor); m_profileValues.m_hDSunIntensity = m_editorUtils.FloatField("SunIntensity", m_profileValues.m_hDSunIntensity); EditorGUI.indentLevel--; GUILayout.Space(20f); } m_editorUtils.Heading("ShadowSettings"); EditorGUI.indentLevel++; m_profileValues.m_hDShadowDistance = m_editorUtils.Slider("ShadowDistance", m_profileValues.m_hDShadowDistance, 0f, 10000f); m_profileValues.m_hDShadowResolution = (GaiaConstants.HDShadowResolution)m_editorUtils.EnumPopup("HDShadowResolution", m_profileValues.m_hDShadowResolution); m_profileValues.m_hDContactShadows = m_editorUtils.Toggle("ContactShadows", m_profileValues.m_hDContactShadows); if (m_profileValues.m_hDContactShadows) { EditorGUI.indentLevel++; m_profileValues.m_hDContactShadowsDistance = m_editorUtils.Slider("ContactShadowsDistance", m_profileValues.m_hDContactShadowsDistance, 1f, 2000f); m_profileValues.m_hDContactShadowQuality = (GaiaConstants.ContactShadowsQuality)m_editorUtils.EnumPopup("ContactShadowsQuality", m_profileValues.m_hDContactShadowQuality); if (m_profileValues.m_hDContactShadowQuality == GaiaConstants.ContactShadowsQuality.Custom) { EditorGUI.indentLevel++; m_profileValues.m_hDContactShadowCustomQuality = m_editorUtils.IntSlider("ContactShadowsSampleCount", m_profileValues.m_hDContactShadowCustomQuality, 4, 64); EditorGUI.indentLevel--; } m_profileValues.m_hDContactShadowOpacity = m_editorUtils.Slider("ContactShadowOpacity", m_profileValues.m_hDContactShadowOpacity, 0f, 1f); EditorGUI.indentLevel--; } m_profileValues.m_hDMicroShadows = m_editorUtils.Toggle("MicroShadows", m_profileValues.m_hDMicroShadows); if (m_profileValues.m_hDMicroShadows) { EditorGUI.indentLevel++; m_profileValues.m_hDMicroShadowOpacity = m_editorUtils.Slider("MicroShadowOpacity", m_profileValues.m_hDMicroShadowOpacity, 0f, 1f); EditorGUI.indentLevel--; } EditorGUI.indentLevel--; GUILayout.Space(20f); if (m_profileValues.m_profileType != GaiaConstants.GaiaLightingProfileType.ProceduralWorldsSky) { m_editorUtils.Heading("SkyboxSettings"); EditorGUI.indentLevel++; m_profileValues.m_hDSkyType = (GaiaConstants.HDSkyType)EditorGUILayout.EnumPopup("Sky Type", m_profileValues.m_hDSkyType); if (m_profileValues.m_hDSkyType == GaiaConstants.HDSkyType.HDRI) { m_profileValues.m_hDHDRISkybox = (Cubemap)m_editorUtils.ObjectField("HDRISkybox", m_profileValues.m_hDHDRISkybox, typeof(Cubemap), false, GUILayout.Height(16f)); m_profileValues.m_hDHDRIExposure = m_editorUtils.FloatField("SkyboxExposure", m_profileValues.m_hDHDRIExposure); m_profileValues.m_hDHDRIMultiplier = m_editorUtils.FloatField("SkyboxMultiplier", m_profileValues.m_hDHDRIMultiplier); } else if (m_profileValues.m_hDSkyType == GaiaConstants.HDSkyType.Procedural) { EditorGUILayout.Space(); m_editorUtils.LabelField("GeometrySettings", EditorStyles.boldLabel); m_profileValues.m_hDPBSPlanetaryRadius = m_editorUtils.FloatField("PBSPlanetaryRadius", m_profileValues.m_hDPBSPlanetaryRadius, helpEnabled); m_profileValues.m_hDPBSPlantetCenterPosition = m_editorUtils.Vector3Field("PBSPlanetCenterPosition", m_profileValues.m_hDPBSPlantetCenterPosition, helpEnabled); EditorGUILayout.Space(); m_editorUtils.LabelField("AirSettings", EditorStyles.boldLabel); m_profileValues.m_hDPBSAirOpacity = m_editorUtils.ColorField("PBSAirOpacity", m_profileValues.m_hDPBSAirOpacity, helpEnabled); m_profileValues.m_hDPBSAirAlbedo = m_editorUtils.ColorField("PBSAirAlbedo", m_profileValues.m_hDPBSAirAlbedo, helpEnabled); m_profileValues.m_hDPBSAirMaximumAltitude = m_editorUtils.FloatField("PBSAirMaximumAltitude", m_profileValues.m_hDPBSAirMaximumAltitude, helpEnabled); EditorGUILayout.Space(); m_editorUtils.LabelField("AerosolsSettings", EditorStyles.boldLabel); m_profileValues.m_hDPBSAerosolDensity = m_editorUtils.Slider("PBSAerosolOpacity", m_profileValues.m_hDPBSAerosolDensity, -1f, 1f, helpEnabled); m_profileValues.m_hDPBSAerosolAlbedo = m_editorUtils.ColorField("PBSAerosolAlbedo", m_profileValues.m_hDPBSAerosolAlbedo, helpEnabled); m_profileValues.m_hDPBSAerosolMaximumAltitude = m_editorUtils.FloatField("PBSAerosolMaximumAltitude", m_profileValues.m_hDPBSAerosolMaximumAltitude, helpEnabled); m_profileValues.m_hDPBSAerosolAnisotropy = m_editorUtils.Slider("PBSAerosolAnisotropy", m_profileValues.m_hDPBSAerosolAnisotropy, -1f, 1f, helpEnabled); EditorGUILayout.Space(); m_editorUtils.LabelField("PlanetSettings", EditorStyles.boldLabel); m_profileValues.m_hDPBSPlanetRotation = m_editorUtils.Vector3Field("PBSPlanetRotation", m_profileValues.m_hDPBSPlanetRotation, helpEnabled); m_profileValues.m_hDPBSGroundTint = m_editorUtils.ColorField("PBSGroundColor", m_profileValues.m_hDPBSGroundTint); m_profileValues.m_hDPBSGroundAlbedoTexture = (Cubemap)m_editorUtils.ObjectField("PBSGroundAlbedoTexture", m_profileValues.m_hDPBSGroundAlbedoTexture, typeof(Cubemap), false, helpEnabled, GUILayout.Height(16f)); m_profileValues.m_hDPBSGroundEmissionTexture = (Cubemap)m_editorUtils.ObjectField("PBSGroundEmissionTexture", m_profileValues.m_hDPBSGroundEmissionTexture, typeof(Cubemap), false, helpEnabled, GUILayout.Height(16f)); EditorGUILayout.Space(); m_editorUtils.LabelField("SpaceSettings", EditorStyles.boldLabel); m_profileValues.m_hDPBSSpaceRotation = m_editorUtils.Vector3Field("PBSSpaceRotation", m_profileValues.m_hDPBSSpaceRotation, helpEnabled); m_profileValues.m_hDPBSSpaceEmissionTexture = (Cubemap)m_editorUtils.ObjectField("PBSSpaceEmissionTexture", m_profileValues.m_hDPBSSpaceEmissionTexture, typeof(Cubemap), false, helpEnabled, GUILayout.Height(16f)); EditorGUILayout.Space(); m_editorUtils.LabelField("ArtisticOverrides", EditorStyles.boldLabel); m_profileValues.m_hDPBSColorSaturation = m_editorUtils.Slider("PBSColorSaturation", m_profileValues.m_hDPBSColorSaturation, 0f, 1f, helpEnabled); m_profileValues.m_hDPBSAlphaSaturation = m_editorUtils.Slider("PBSAlphaSaturation", m_profileValues.m_hDPBSAlphaSaturation, 0f, 1f, helpEnabled); m_profileValues.m_hDPBSAlphaMultiplier = m_editorUtils.Slider("PBSAlphaMultiplier", m_profileValues.m_hDPBSAlphaMultiplier, 0f, 1f, helpEnabled); m_profileValues.m_hDPBSHorizonTint = m_editorUtils.ColorField("PBSHorizonTint", m_profileValues.m_hDPBSHorizonTint, helpEnabled); m_profileValues.m_hDPBSHorizonZenithShift = m_editorUtils.Slider("PBSHorizonZenithShift", m_profileValues.m_hDPBSHorizonZenithShift, -1f, 1f, helpEnabled); m_profileValues.m_hDPBSZenithTint = m_editorUtils.ColorField("PBSZenithTint", m_profileValues.m_hDPBSZenithTint, helpEnabled); EditorGUILayout.Space(); m_editorUtils.LabelField("MiscellaneousSettings", EditorStyles.boldLabel); m_profileValues.m_hDPBSNumberOfBounces = m_editorUtils.IntSlider("PBSNumberOfBounces", m_profileValues.m_hDPBSNumberOfBounces, 1, 10, helpEnabled); m_profileValues.m_hDPBSIntensityMode = (GaiaConstants.HDIntensityMode)m_editorUtils.EnumPopup("PBSIntensityMode", m_profileValues.m_hDPBSIntensityMode, helpEnabled); if (m_profileValues.m_hDPBSIntensityMode == GaiaConstants.HDIntensityMode.Exposure) { m_profileValues.m_hDPBSExposure = m_editorUtils.FloatField("PBSExposure", m_profileValues.m_hDPBSExposure, helpEnabled); } else { m_profileValues.m_hDPBSMultiplier = m_editorUtils.FloatField("PBSMultiplier", m_profileValues.m_hDPBSMultiplier, helpEnabled); } m_profileValues.m_hDPBSIncludeSunInBaking = m_editorUtils.Toggle("PBSIncludeSunInBaking", m_profileValues.m_hDPBSIncludeSunInBaking, helpEnabled); } else { m_profileValues.m_hDGradientTopColor = m_editorUtils.ColorField("TopColor", m_profileValues.m_hDGradientTopColor); m_profileValues.m_hDGradientMiddleColor = m_editorUtils.ColorField("MiddleColor", m_profileValues.m_hDGradientMiddleColor); m_profileValues.m_hDGradientBottomColor = m_editorUtils.ColorField("BottomColor", m_profileValues.m_hDGradientBottomColor); m_profileValues.m_hDGradientDiffusion = m_editorUtils.FloatField("Diffusion", m_profileValues.m_hDGradientDiffusion); m_profileValues.m_hDGradientExposure = m_editorUtils.FloatField("Exposure", m_profileValues.m_hDGradientExposure); m_profileValues.m_hDGradientMultiplier = m_editorUtils.FloatField("Multiplier", m_profileValues.m_hDGradientMultiplier); } EditorGUI.indentLevel--; GUILayout.Space(20f); } m_editorUtils.Heading("AmbientSettings"); EditorGUI.indentLevel++; m_profileValues.m_hDAmbientMode = (GaiaConstants.HDAmbientMode)EditorGUILayout.EnumPopup("Ambient Mode", m_profileValues.m_hDAmbientMode); #if !UNITY_2019_3_OR_NEWER m_profileValues.m_hDAmbientDiffuseIntensity = m_editorUtils.FloatField("DiffuseIntensity", m_profileValues.m_hDAmbientDiffuseIntensity); m_profileValues.m_hDAmbientSpecularIntensity = m_editorUtils.FloatField("SpecularIntensity", m_profileValues.m_hDAmbientSpecularIntensity); #else if (m_profileValues.m_hDAmbientMode == GaiaConstants.HDAmbientMode.Static) { EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("HDRP2019_3AmbientMode"), MessageType.Info); } #endif EditorGUI.indentLevel--; GUILayout.Space(20f); if (m_profileValues.m_profileType != GaiaConstants.GaiaLightingProfileType.ProceduralWorldsSky) { m_editorUtils.Heading("FogSettings"); EditorGUI.indentLevel++; m_profileValues.m_hDFogType2019_3 = (GaiaConstants.HDFogType2019_3)EditorGUILayout.EnumPopup("Fog Mode", m_profileValues.m_hDFogType2019_3); if (m_profileValues.m_hDFogType2019_3 == GaiaConstants.HDFogType2019_3.None) { EditorGUILayout.HelpBox("No fog mode selected. If you want to use fog please select a different mode", MessageType.Info); } else { m_profileValues.m_hDVolumetricFogScatterColor = m_editorUtils.ColorField("ScatterColor", m_profileValues.m_hDVolumetricFogScatterColor); m_profileValues.m_hDVolumetricFogDistance = m_editorUtils.FloatField("FogDistance", m_profileValues.m_hDVolumetricFogDistance); if (m_profileValues.m_hDVolumetricFogDistance < 0f) { m_profileValues.m_hDVolumetricFogDistance = 0f; } m_profileValues.m_hDVolumetricFogBaseHeight = m_editorUtils.FloatField("FogBaseHeight", m_profileValues.m_hDVolumetricFogBaseHeight); if (m_profileValues.m_hDVolumetricFogBaseHeight < 0f) { m_profileValues.m_hDVolumetricFogBaseHeight = 0f; } m_profileValues.m_hDVolumetricFogMeanHeight = m_editorUtils.FloatField("FogMeanHeight", m_profileValues.m_hDVolumetricFogMeanHeight); if (m_profileValues.m_hDVolumetricFogMeanHeight < 0f) { m_profileValues.m_hDVolumetricFogMeanHeight = 0f; } m_profileValues.m_hDVolumetricFogAnisotropy = m_editorUtils.Slider("FogAnisotropy", m_profileValues.m_hDVolumetricFogAnisotropy, 0f, 1f); m_profileValues.m_hDVolumetricFogProbeDimmer = m_editorUtils.Slider("FogProbeDimmer", m_profileValues.m_hDVolumetricFogProbeDimmer, 0f, 1f); m_profileValues.m_hDVolumetricFogMaxDistance = m_editorUtils.FloatField("MaxFogDistance", m_profileValues.m_hDVolumetricFogMaxDistance); if (m_profileValues.m_hDVolumetricFogMaxDistance < 0f) { m_profileValues.m_hDVolumetricFogMaxDistance = 0f; } m_profileValues.m_hDVolumetricFogDepthExtent = m_editorUtils.FloatField("FogDepthExtent", m_profileValues.m_hDVolumetricFogDepthExtent); if (m_profileValues.m_hDVolumetricFogDepthExtent < 0f) { m_profileValues.m_hDVolumetricFogDepthExtent = 0f; } m_profileValues.m_hDVolumetricFogSliceDistribution = m_editorUtils.Slider("FogSliceDistribution", m_profileValues.m_hDVolumetricFogSliceDistribution, 0f, 1f); } EditorGUI.indentLevel--; } } GUI.enabled = true; } #if !GAIA_PRO_PRESENT GUI.enabled = currentGUIState; #endif }