コード例 #1
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.supportSSR ?? false)
            {
                EditorGUILayout.Space();
                EditorGUILayout.HelpBox("The current HDRP Asset does not support Screen Space Reflection.", MessageType.Error, wide: true);
                return;
            }

            PropertyField(m_Enable);

            // If ray tracing is supported display the tracing choice
            if (HDRenderPipeline.pipelineSupportsRayTracing)
            {
                PropertyField(m_Tracing, k_TracingText);
            }

            // Flag to track if the ray tracing parameters were displayed
            RayCastingMode tracingMode = m_Tracing.value.GetEnumValue <RayCastingMode>();
            bool           rayTracingSettingsDisplayed = HDRenderPipeline.pipelineSupportsRayTracing &&
                                                         m_Tracing.overrideState.boolValue &&
                                                         tracingMode != RayCastingMode.RayMarching;

            // The rest of the ray tracing UI is only displayed if the asset supports ray tracing and the checkbox is checked.
            if (rayTracingSettingsDisplayed)
            {
                RayTracedReflectionGUI(tracingMode);
            }
            else
            {
                PropertyField(m_UsedAlgorithm, k_Algo);

                // Shared Data
                PropertyField(m_MinSmoothness, k_MinimumSmoothnessText);
                PropertyField(m_SmoothnessFadeStart, k_SmoothnessFadeStartText);
                PropertyField(m_ReflectSky, k_ReflectSkyText);
                m_SmoothnessFadeStart.value.floatValue = Mathf.Max(m_MinSmoothness.value.floatValue, m_SmoothnessFadeStart.value.floatValue);

                PropertyField(m_ScreenFadeDistance, k_ScreenFaceDistanceText);
                PropertyField(m_DepthBufferThickness, k_DepthBufferThicknessText);

                m_DepthBufferThickness.value.floatValue = Mathf.Clamp(m_DepthBufferThickness.value.floatValue, 0.001f, 1.0f);

                base.OnInspectorGUI();

                using (new HDEditorUtils.IndentScope())
                    using (new QualityScope(this))
                    {
                        PropertyField(m_RayMaxIterations, k_RayMaxIterationsText);
                        m_RayMaxIterations.value.intValue = Mathf.Max(0, m_RayMaxIterations.value.intValue);
                    }
                if (m_UsedAlgorithm.value.intValue == (int)ScreenSpaceReflectionAlgorithm.PBRAccumulation)
                {
                    PropertyField(m_AccumulationFactor, k_AccumulationFactorText);
                }
            }
        }
コード例 #2
0
        void RayTracedReflectionGUI(RayCastingMode tracingMode)
        {
            HDRenderPipelineAsset currentAsset = HDRenderPipeline.currentAsset;

            using (new IndentLevelScope())
            {
                EditorGUILayout.LabelField("Fallback", EditorStyles.miniLabel);
                PropertyField(m_RayMiss, k_RayMissFallbackHierarchyText);
                PropertyField(m_LastBounce, k_LastBounceFallbackHierarchyText);
            }
            PropertyField(m_LayerMask, k_LayerMaskText);
            PropertyField(m_TextureLodBias, k_TextureLodBiasText);

            if (currentAsset.currentPlatformRenderPipelineSettings.supportedRayTracingMode == RenderPipelineSettings.SupportedRayTracingMode.Both)
            {
                if (tracingMode == RayCastingMode.RayTracing)
                {
                    PropertyField(m_Mode, k_ModeText);

                    using (new IndentLevelScope())
                    {
                        switch (m_Mode.value.GetEnumValue <RayTracingMode>())
                        {
                        case RayTracingMode.Performance:
                            RayTracingPerformanceModeGUI(false);
                            break;

                        case RayTracingMode.Quality:
                            RayTracingQualityModeGUI();
                            break;
                        }
                    }
                }
                else
                {
                    RayTracingPerformanceModeGUI(true);
                }
            }
            else if (currentAsset.currentPlatformRenderPipelineSettings.supportedRayTracingMode == RenderPipelineSettings.SupportedRayTracingMode.Quality)
            {
                if (tracingMode == RayCastingMode.RayTracing)
                {
                    RayTracingQualityModeGUI();
                }
                else
                {
                    HDEditorUtils.QualitySettingsHelpBox("The current HDRP Asset does not support the mixed mode which is only available in performance mode.", MessageType.Error,
                                                         HDRenderPipelineUI.Expandable.Rendering, "m_RenderPipelineSettings.supportedRayTracingMode");
                }
            }
            else
            {
                RayTracingPerformanceModeGUI(tracingMode == RayCastingMode.Mixed);
            }
        }
コード例 #3
0
        void RayTracedReflectionGUI(RayCastingMode tracingMode)
        {
            HDRenderPipelineAsset currentAsset = HDRenderPipeline.currentAsset;

            PropertyField(m_ReflectSky, k_ReflectSkyText);
            PropertyField(m_LayerMask, k_LayerMaskText);
            PropertyField(m_TextureLodBias, k_TextureLodBiasText);

            if (currentAsset.currentPlatformRenderPipelineSettings.supportedRayTracingMode == RenderPipelineSettings.SupportedRayTracingMode.Both)
            {
                if (tracingMode == RayCastingMode.RayTracing)
                {
                    PropertyField(m_Mode, k_ModeText);

                    using (new HDEditorUtils.IndentScope())
                    {
                        switch (m_Mode.value.GetEnumValue <RayTracingMode>())
                        {
                        case RayTracingMode.Performance:
                            RayTracingPerformanceModeGUI(false);
                            break;

                        case RayTracingMode.Quality:
                            RayTracingQualityModeGUI();
                            break;
                        }
                    }
                }
                else
                {
                    RayTracingPerformanceModeGUI(true);
                }
            }
            else if (currentAsset.currentPlatformRenderPipelineSettings.supportedRayTracingMode == RenderPipelineSettings.SupportedRayTracingMode.Quality)
            {
                if (tracingMode == RayCastingMode.RayTracing)
                {
                    RayTracingQualityModeGUI();
                }
                else
                {
                    EditorGUILayout.HelpBox("The current HDRP Asset does not support the mixed mode which is only available in performance mode.", MessageType.Error, wide: true);
                }
            }
            else
            {
                RayTracingPerformanceModeGUI(tracingMode == RayCastingMode.Mixed);
            }
        }
コード例 #4
0
        public override void OnInspectorGUI()
        {
            HDRenderPipelineAsset currentAsset = HDRenderPipeline.currentAsset;

            if (!currentAsset?.currentPlatformRenderPipelineSettings.supportSSGI ?? false)
            {
                EditorGUILayout.Space();
                EditorGUILayout.HelpBox("The current HDRP Asset does not support Screen Space Global illumination.", MessageType.Error, wide: true);
                return;
            }

            PropertyField(m_Enable);

            // If ray tracing is supported display the content of the volume component
            if (HDRenderPipeline.pipelineSupportsRayTracing)
            {
                PropertyField(m_Tracing);
            }

            // Flag to track if the ray tracing parameters were displayed
            RayCastingMode tracingMode = m_Tracing.value.GetEnumValue <RayCastingMode>();
            bool           rayTracingSettingsDisplayed = HDRenderPipeline.pipelineSupportsRayTracing &&
                                                         m_Tracing.overrideState.boolValue &&
                                                         tracingMode != RayCastingMode.RayMarching;

            using (new IndentLevelScope())
            {
                if (rayTracingSettingsDisplayed)
                {
                    PropertyField(m_LayerMask);
                    PropertyField(m_TextureLodBias);

                    if (currentAsset.currentPlatformRenderPipelineSettings.supportedRayTracingMode == RenderPipelineSettings.SupportedRayTracingMode.Both)
                    {
                        if (tracingMode == RayCastingMode.RayTracing)
                        {
                            PropertyField(m_Mode);
                            using (new IndentLevelScope())
                            {
                                switch (m_Mode.value.GetEnumValue <RayTracingMode>())
                                {
                                case RayTracingMode.Performance:
                                {
                                    RayTracingPerformanceModeGUI(false);
                                }
                                break;

                                case RayTracingMode.Quality:
                                {
                                    RayTracingQualityModeGUI();
                                }
                                break;
                                }
                            }
                        }
                        else
                        {
                            RayTracingPerformanceModeGUI(true);
                        }
                    }
                    else if (currentAsset.currentPlatformRenderPipelineSettings.supportedRayTracingMode == RenderPipelineSettings.SupportedRayTracingMode.Quality)
                    {
                        if (tracingMode == RayCastingMode.RayTracing)
                        {
                            RayTracingQualityModeGUI();
                        }
                        else
                        {
                            EditorGUILayout.HelpBox("The current HDRP Asset does not support the mixed mode which is only available in performance mode.", MessageType.Error, wide: true);
                        }
                    }
                    else
                    {
                        RayTracingPerformanceModeGUI(tracingMode == RayCastingMode.Mixed);
                    }
                    PropertyField(m_ReceiverMotionRejection);
                }
                else
                {
                    base.OnInspectorGUI(); // Quality Setting

                    using (new IndentLevelScope())
                        using (new QualityScope(this))
                        {
                            PropertyField(m_RaySteps);
                            DenoiserSSGUI();
                        }
                    PropertyField(m_DepthBufferThickness, k_DepthBufferThicknessText);
                    PropertyField(m_FallbackHierarchy, k_FallbackHierarchyText);
                }
            }
        }
コード例 #5
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.supportSSR ?? false)
            {
                EditorGUILayout.Space();
                HDEditorUtils.QualitySettingsHelpBox("The current HDRP Asset does not support Screen Space Reflection.", MessageType.Error,
                                                     HDRenderPipelineUI.Expandable.Reflection, "m_RenderPipelineSettings.supportSSR");
                return;
            }

            PropertyField(m_Enable, k_EnabledOpaque);

            bool transparentSSRSupported = currentAsset.currentPlatformRenderPipelineSettings.supportSSR &&
                                           currentAsset.currentPlatformRenderPipelineSettings.supportSSRTransparent &&
                                           currentAsset.currentPlatformRenderPipelineSettings.supportTransparentDepthPrepass;

            if (transparentSSRSupported)
            {
                PropertyField(m_EnableTransparent, k_EnabledTransparent);
            }
            else
            {
                EditorGUILayout.Space();
                EditorGUILayout.HelpBox("The current HDRP Asset does not support Transparent Screen Space Reflection.", MessageType.Info, wide: true);
            }

            // If ray tracing is supported display the tracing choice
            if (HDRenderPipeline.assetSupportsRayTracing)
            {
                PropertyField(m_Tracing, k_TracingText);
            }

            // Flag to track if the ray tracing parameters were displayed
            RayCastingMode tracingMode = m_Tracing.value.GetEnumValue <RayCastingMode>();
            bool           rayTracingSettingsDisplayed = HDRenderPipeline.assetSupportsRayTracing &&
                                                         m_Tracing.overrideState.boolValue &&
                                                         tracingMode != RayCastingMode.RayMarching;

            // The rest of the ray tracing UI is only displayed if the asset supports ray tracing and the checkbox is checked.
            if (rayTracingSettingsDisplayed)
            {
                RayTracedReflectionGUI(tracingMode);
            }
            else
            {
                PropertyField(m_UsedAlgorithm, k_Algo);

                // Shared Data
                PropertyField(m_MinSmoothness, k_MinimumSmoothnessText);
                PropertyField(m_SmoothnessFadeStart, k_SmoothnessFadeStartText);
                PropertyField(m_ReflectSky, k_ReflectSkyText);
                m_SmoothnessFadeStart.value.floatValue = Mathf.Max(m_MinSmoothness.value.floatValue, m_SmoothnessFadeStart.value.floatValue);

                PropertyField(m_ScreenFadeDistance, k_ScreenFaceDistanceText);
                PropertyField(m_DepthBufferThickness, k_DepthBufferThicknessText);

                m_DepthBufferThickness.value.floatValue = Mathf.Clamp(m_DepthBufferThickness.value.floatValue, 0.001f, 1.0f);

                base.OnInspectorGUI();

                using (new IndentLevelScope())
                    using (new QualityScope(this))
                    {
                        PropertyField(m_RayMaxIterations, k_RayMaxIterationsText);
                        m_RayMaxIterations.value.intValue = Mathf.Max(0, m_RayMaxIterations.value.intValue);
                    }
                if (m_UsedAlgorithm.value.intValue == (int)ScreenSpaceReflectionAlgorithm.PBRAccumulation)
                {
                    PropertyField(m_AccumulationFactor, k_AccumulationFactorText);
                    PropertyField(m_EnableWorldSpeedRejection, k_EnableSpeedRejectionText);
                    if (BeginAdditionalPropertiesScope())
                    {
                        if (m_EnableWorldSpeedRejection.value.boolValue)
                        {
                            using (new IndentLevelScope())
                            {
                                PropertyField(m_SpeedRejectionScalerFactor, k_SpeedRejectionScalerFactorText);
                                PropertyField(m_SpeedSmoothReject, k_SpeedSmoothRejectText);
                            }
                        }
                        PropertyField(m_SpeedRejectionFactor, k_SpeedRejectionFactorText);
                        if (!m_SpeedSurfaceOnly.value.boolValue && !m_SpeedTargetOnly.value.boolValue)
                        {
                            m_SpeedSurfaceOnly.value.boolValue = true;
                        }
                        PropertyField(m_SpeedSurfaceOnly, k_SpeedSurfaceOnlyText);
                        PropertyField(m_SpeedTargetOnly, k_SpeedTargetOnlyText);
                        PropertyField(m_BiasFactor, k_BiasFactorText);
                    }
                    EndAdditionalPropertiesScope();
                }
            }
        }