Пример #1
0
        public override void OnInspectorGUI()
        {
#if UNITY_EDITOR
            UnityEditor.BuildTarget activeBuildTarget = UnityEditor.EditorUserBuildSettings.activeBuildTarget;
            if (activeBuildTarget == UnityEditor.BuildTarget.StandaloneOSX)
#else
            if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.Metal)
#endif
            {
                EditorGUILayout.Space();
                EditorGUILayout.HelpBox("Volumetric Clouds are not supported on the current target platform.", MessageType.Error, wide: true);
                return;
            }

            // This whole editor has nothing to display if the SSR feature is not supported
            HDRenderPipelineAsset currentAsset = HDRenderPipeline.currentAsset;
            if (!currentAsset?.currentPlatformRenderPipelineSettings.supportVolumetricClouds ?? false)
            {
                EditorGUILayout.Space();
                EditorGUILayout.HelpBox("The current HDRP Asset does not support Volumetric Clouds.", MessageType.Error, wide: true);
                return;
            }

            EditorGUILayout.HelpBox("Volumetric Clouds are only displayed up to the far plane of the used camera. Make sure to increase the far and near planes accordingly.", MessageType.Info);

            EditorGUILayout.LabelField("General", EditorStyles.miniLabel);
            PropertyField(m_Enable);
            EditorGUILayout.Space();

            EditorGUILayout.LabelField("Shape", EditorStyles.miniLabel);
            PropertyField(m_CloudControl);
            VolumetricClouds.CloudControl controlMode = (VolumetricClouds.CloudControl)m_CloudControl.value.enumValueIndex;
            using (new HDEditorUtils.IndentScope())
            {
                bool needsIntendation = false;
                if (controlMode == VolumetricClouds.CloudControl.Advanced)
                {
                    PropertyField(m_CumulusMap);
                    PropertyField(m_CumulusMapMultiplier);
                    PropertyField(m_AltoStratusMap);
                    PropertyField(m_AltoStratusMapMultiplier);
                    PropertyField(m_CumulonimbusMap);
                    PropertyField(m_CumulonimbusMapMultiplier);
                    PropertyField(m_RainMap);
                    PropertyField(m_CloudMapResolution);
                    PropertyField(m_CloudTiling);
                    PropertyField(m_CloudOffset);
                }
                else if (controlMode == VolumetricClouds.CloudControl.Manual)
                {
                    PropertyField(m_CloudMap);
                    PropertyField(m_CloudLut);
                    PropertyField(m_CloudTiling);
                    PropertyField(m_CloudOffset);
                }
                else
                {
                    needsIntendation = true;
                    PropertyField(m_CloudPreset);
                }

                VolumetricClouds.CloudPresets controlPreset = (VolumetricClouds.CloudPresets)m_CloudPreset.value.enumValueIndex;
                if ((controlMode != VolumetricClouds.CloudControl.Simple) || controlMode == VolumetricClouds.CloudControl.Simple && controlPreset == VolumetricClouds.CloudPresets.Custom)
                {
                    using (new HDEditorUtils.IndentScope(needsIntendation ? 16 : 0))
                    {
                        PropertyField(m_DensityMultiplier);
                        PropertyField(m_ShapeFactor);
                        PropertyField(m_ShapeScale);
                        PropertyField(m_ErosionFactor);
                        PropertyField(m_ErosionScale);
                    }
                }
            }

            PropertyField(m_EarthCurvature);
            PropertyField(m_LowestCloudAltitude);
            PropertyField(m_CloudThickness);

            DrawHeader("Wind");
            PropertyField(m_GlobalWindSpeed);
            using (new HDEditorUtils.IndentScope())
            {
                PropertyField(m_Orientation);
                PropertyField(m_CloudMapSpeedMultiplier);
                PropertyField(m_ShapeSpeedMultiplier);
                PropertyField(m_ErosionSpeedMultiplier);
            }

            DrawHeader("Quality");
            {
                PropertyField(m_TemporalAccumulationFactor);
                PropertyField(m_NumPrimarySteps);
                PropertyField(m_NumLightSteps);
            }

            DrawHeader("Lighting");
            {
                PropertyField(m_AmbientLightProbeDimmer);
                PropertyField(m_ScatteringDirection);
                PropertyField(m_ScatteringTint);
                PropertyField(m_PowderEffectIntensity);
                PropertyField(m_MultiScattering);
            }

            DrawHeader("Shadows");
            {
                PropertyField(m_Shadows);
                using (new HDEditorUtils.IndentScope())
                {
                    PropertyField(m_ShadowResolution);
                    PropertyField(m_ShadowOpacity);
                    PropertyField(m_ShadowDistance);
                    PropertyField(m_ShadowPlaneHeightOffset);
                    PropertyField(m_ShadowOpacityFallback);
                }
            }
        }
Пример #2
0
        public override void OnInspectorGUI()
        {
            // This whole editor has nothing to display if the SSR feature is not supported
            HDRenderPipelineAsset currentAsset = HDRenderPipeline.currentAsset;

            if (!currentAsset?.currentPlatformRenderPipelineSettings.supportVolumetricClouds ?? false)
            {
                EditorGUILayout.Space();
                HDEditorUtils.QualitySettingsHelpBox("The current HDRP Asset does not support Volumetric Clouds.", MessageType.Error,
                                                     HDRenderPipelineUI.Expandable.Volumetric, "m_RenderPipelineSettings.supportVolumetricClouds");
                return;
            }


            EditorGUILayout.LabelField("General", EditorStyles.miniLabel);
            PropertyField(m_Enable);
            PropertyField(m_LocalClouds);
            if (m_LocalClouds.value.boolValue)
            {
                EditorGUILayout.HelpBox("Volumetric Clouds are only displayed up to the far plane of the used camera. Make sure to increase the far and near planes accordingly.", MessageType.Info);
            }
            EditorGUILayout.Space();

            EditorGUILayout.LabelField("Shape", EditorStyles.miniLabel);
            PropertyField(m_CloudControl);
            VolumetricClouds.CloudControl controlMode = (VolumetricClouds.CloudControl)m_CloudControl.value.enumValueIndex;
            bool hasCloudMap = true;

            using (new IndentLevelScope())
            {
                bool needsIntendation = false;
                if (controlMode == VolumetricClouds.CloudControl.Advanced)
                {
                    PropertyField(m_CumulusMap);
                    PropertyField(m_CumulusMapMultiplier);
                    PropertyField(m_AltoStratusMap);
                    PropertyField(m_AltoStratusMapMultiplier);
                    PropertyField(m_CumulonimbusMap);
                    PropertyField(m_CumulonimbusMapMultiplier);
                    PropertyField(m_RainMap);
                    PropertyField(m_CloudMapResolution);
                    PropertyField(m_CloudTiling, k_CloudMapTilingText);
                    PropertyField(m_CloudOffset, k_CloudMapOffsetText);
                }
                else if (controlMode == VolumetricClouds.CloudControl.Manual)
                {
                    PropertyField(m_CloudMap);
                    PropertyField(m_CloudLut);
                    PropertyField(m_CloudTiling, k_CloudMapTilingText);
                    PropertyField(m_CloudOffset, k_CloudMapOffsetText);
                }
                else
                {
                    hasCloudMap      = false;
                    needsIntendation = true;
                    PropertyField(m_CloudPreset);
                }

                VolumetricClouds.CloudPresets controlPreset = (VolumetricClouds.CloudPresets)m_CloudPreset.value.enumValueIndex;
                if ((controlMode != VolumetricClouds.CloudControl.Simple) || controlMode == VolumetricClouds.CloudControl.Simple && controlPreset == VolumetricClouds.CloudPresets.Custom)
                {
                    using (new IndentLevelScope(needsIntendation ? 16 : 0))
                    {
                        PropertyField(m_DensityMultiplier);
                        if (controlMode == VolumetricClouds.CloudControl.Simple)
                        {
                            PropertyField(m_CustomDensityCurve);
                        }
                        PropertyField(m_ShapeFactor);
                        PropertyField(m_ShapeScale);
                        PropertyField(m_ShapeOffset);
                        PropertyField(m_ErosionFactor);
                        PropertyField(m_ErosionScale);
                        PropertyField(m_ErosionNoiseType);
                        if (controlMode == VolumetricClouds.CloudControl.Simple)
                        {
                            PropertyField(m_CustomErosionCurve);
                            PropertyField(m_CustomAmbientOcclusionCurve);
                        }
                    }
                }
                else
                {
                    PropertyField(m_ShapeOffset);
                }
            }

            PropertyField(m_EarthCurvature);
            PropertyField(m_LowestCloudAltitude);
            PropertyField(m_CloudThickness);

            DrawHeader("Wind");
            PropertyField(m_GlobalWindSpeed, k_GlobalHorizontalWindSpeedText);
            if (showAdditionalProperties)
            {
                using (new IndentLevelScope())
                {
                    if (hasCloudMap)
                    {
                        PropertyField(m_CloudMapSpeedMultiplier);
                    }
                    PropertyField(m_ShapeSpeedMultiplier);
                    PropertyField(m_ErosionSpeedMultiplier);
                }
            }
            PropertyField(m_Orientation);
            using (new IndentLevelScope())
            {
                PropertyField(m_AltitudeDistortion);
            }

            PropertyField(m_VerticalShapeWindSpeed);
            PropertyField(m_VerticalErosionWindSpeed);

            DrawHeader("Lighting");
            {
                PropertyField(m_AmbientLightProbeDimmer);
                PropertyField(m_SunLightDimmer);
                PropertyField(m_ErosionOcclusion);
                PropertyField(m_ScatteringTint);
                PropertyField(m_PowderEffectIntensity);
                PropertyField(m_MultiScattering);
            }

            DrawHeader("Shadows");
            {
                PropertyField(m_Shadows);
                using (new IndentLevelScope())
                {
                    PropertyField(m_ShadowResolution);
                    PropertyField(m_ShadowOpacity);
                    PropertyField(m_ShadowDistance);
                    PropertyField(m_ShadowPlaneHeightOffset);
                    PropertyField(m_ShadowOpacityFallback);
                }
            }

            DrawHeader("Quality");
            {
                PropertyField(m_TemporalAccumulationFactor);
                PropertyField(m_GhostingReduction);
                PropertyField(m_NumPrimarySteps);
                PropertyField(m_NumLightSteps);
                PropertyField(m_FadeInMode);
                using (new IndentLevelScope())
                {
                    if ((VolumetricClouds.CloudFadeInMode)m_FadeInMode.value.enumValueIndex == (VolumetricClouds.CloudFadeInMode.Manual))
                    {
                        PropertyField(m_FadeInStart);
                        PropertyField(m_FadeInDistance);
                    }
                }
            }
        }