예제 #1
0
        protected float GetExposure(SkySettings skySettings, DebugDisplaySettings debugSettings)
        {
            float debugExposure = 0.0f;

            if (debugSettings != null && debugSettings.DebugNeedsExposure())
            {
                debugExposure = debugSettings.data.lightingDebugSettings.debugExposure;
            }
            return(ColorUtils.ConvertEV100ToExposure(-(skySettings.exposure.value + debugExposure)));
        }
        /// <summary>Setup the display manager if necessary.</summary>
        /// <param name="debugDisplaySettings"></param>
        public void SetupDebugData(ref DebugDisplaySettings debugDisplaySettings)
        {
            if (!isValid)
            {
                return;
            }

            debugDisplaySettings = new DebugDisplaySettings();
            m_Settings.FillDebugData(debugDisplaySettings);
        }
 public void RenderDebugOverlay(HDCamera hdCamera, CommandBuffer cmd, DebugDisplaySettings debugDisplaySettings, ref float x, ref float y, float overlaySize, float width)
 {
     if (debugDisplaySettings.decalsDebugSettings.m_DisplayAtlas)
     {
         using (new ProfilingSample(cmd, "Display Decal Atlas", CustomSamplerId.DisplayDebugDecalsAtlas.GetSampler()))
         {
             HDUtils.BlitQuad(cmd, Atlas.AtlasTexture, new Vector4(1, 1, 0, 0), new Vector4(width / hdCamera.actualWidth, overlaySize / hdCamera.actualHeight, x / hdCamera.actualWidth, y / hdCamera.actualHeight), (int)debugDisplaySettings.decalsDebugSettings.m_MipLevel, true);
             HDUtils.NextOverlayCoord(ref x, ref y, overlaySize, overlaySize, hdCamera.actualWidth);
         }
     }
 }
 public void RenderDebugOverlay(HDCamera hdCamera, CommandBuffer cmd, DebugDisplaySettings debugDisplaySettings, ref float x, ref float y, float overlaySize, float width)
 {
     if (debugDisplaySettings.data.decalsDebugSettings.displayAtlas)
     {
         using (new ProfilingSample(cmd, "Display Decal Atlas", CustomSamplerId.DisplayDebugDecalsAtlas.GetSampler()))
         {
             cmd.SetViewport(new Rect(x, y, overlaySize, overlaySize));
             HDUtils.BlitQuad(cmd, Atlas.AtlasTexture, new Vector4(1, 1, 0, 0), new Vector4(1, 1, 0, 0), (int)debugDisplaySettings.data.decalsDebugSettings.mipLevel, true);
             HDUtils.NextOverlayCoord(ref x, ref y, overlaySize, overlaySize, hdCamera);
         }
     }
 }
예제 #5
0
 void RegisterDebug()
 {
     if (!m_IsDebugRegistered)
     {
         // Note that we register m_FrameSettingsRuntime, so manipulating it in the Debug windows
         // doesn't affect the serialized version
         if (m_camera.cameraType != CameraType.Preview && m_camera.cameraType != CameraType.Reflection)
         {
             DebugDisplaySettings.RegisterCamera(m_camera, this);
         }
         m_CameraRegisterName = m_camera.name;
         m_IsDebugRegistered  = true;
     }
 }
예제 #6
0
        void UnRegisterDebug()
        {
            if (m_camera == null)
            {
                return;
            }

            if (m_IsDebugRegistered)
            {
                if (m_camera.cameraType != CameraType.Preview && m_camera.cameraType != CameraType.Reflection)
                {
                    DebugDisplaySettings.UnRegisterCamera(m_camera, this);
                }
                m_IsDebugRegistered = false;
            }
        }
        public void FillDebugData(DebugDisplaySettings debug)
        {
            debug.SetDebugViewCommonMaterialProperty(m_MaterialProperty);

            switch (m_LightingProperty)
            {
            case LightingProperty.DiffuseOnly:
                debug.SetDebugLightingMode(DebugLightingMode.DiffuseLighting);
                break;

            case LightingProperty.SpecularOnly:
                debug.SetDebugLightingMode(DebugLightingMode.SpecularLighting);
                break;

            default:
            {
                debug.SetDebugLightingMode(DebugLightingMode.None);
                break;
            }
            }

            debug.SetDebugLightFilterMode(m_LightFilterProperty);

            switch (m_DebugFullScreen)
            {
            case DebugFullScreen.None:
                debug.SetFullScreenDebugMode(FullScreenDebugMode.None);
                break;

            case DebugFullScreen.Depth:
                debug.SetFullScreenDebugMode(FullScreenDebugMode.DepthPyramid);
                break;

            case DebugFullScreen.ScreenSpaceAmbientOcclusion:
                debug.SetFullScreenDebugMode(FullScreenDebugMode.SSAO);
                break;

            case DebugFullScreen.MotionVectors:
                debug.SetFullScreenDebugMode(FullScreenDebugMode.MotionVectors);
                break;

            default:
                throw new ArgumentException("Unknown DebugFullScreen");
            }
        }
        public void Init(HDRenderPipelineRayTracingResources rayTracingResources, DebugDisplaySettings currentDebugDisplaySettings)
        {
            // Keep track of the external resources
            m_DebugDisplaySettings = currentDebugDisplaySettings;
            m_PipelineResources    = rayTracingResources;

            m_RayCountTexture = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: GraphicsFormat.R32G32B32A32_UInt, enableRandomWrite: true, useMipMap: false, name: "RayCountTexture");

            // We only require 3 buffers (this supports a maximal size of 8192x8192)
            m_ReducedRayCountBuffer0 = new ComputeBuffer(4 * 256 * 256, sizeof(uint));
            m_ReducedRayCountBuffer1 = new ComputeBuffer(4 * 32 * 32, sizeof(uint));
            m_ReducedRayCountBuffer2 = new ComputeBuffer(4, sizeof(uint));

            // Initialize the cpu ray count (Optional)
            for (int i = 0; i < 4; ++i)
            {
                m_ReducedRayCountValues[i] = 0;
            }
        }
예제 #9
0
        public void RenderSky(SkyUpdateContext skyContext, HDCamera hdCamera, Light sunLight, RTHandleSystem.RTHandle colorBuffer, RTHandleSystem.RTHandle depthBuffer, DebugDisplaySettings debugSettings, CommandBuffer cmd)
        {
            if (skyContext.IsValid() && hdCamera.clearColorMode == HDAdditionalCameraData.ClearColorMode.Sky)
            {
                using (new ProfilingSample(cmd, "Sky Pass"))
                {
                    m_BuiltinParameters.commandBuffer             = cmd;
                    m_BuiltinParameters.sunLight                  = sunLight;
                    m_BuiltinParameters.pixelCoordToViewDirMatrix = HDUtils.ComputePixelCoordToWorldSpaceViewDirectionMatrix(hdCamera.camera.fieldOfView * Mathf.Deg2Rad, hdCamera.screenSize, hdCamera.viewMatrix, false);
                    m_BuiltinParameters.invViewProjMatrix         = hdCamera.viewProjMatrix.inverse;
                    m_BuiltinParameters.screenSize                = hdCamera.screenSize;
                    m_BuiltinParameters.cameraPosWS               = hdCamera.camera.transform.position;
                    m_BuiltinParameters.colorBuffer               = colorBuffer;
                    m_BuiltinParameters.depthBuffer               = depthBuffer;
                    m_BuiltinParameters.hdCamera                  = hdCamera;
                    m_BuiltinParameters.debugSettings             = debugSettings;

                    skyContext.renderer.SetRenderTargets(m_BuiltinParameters);
                    skyContext.renderer.RenderSky(m_BuiltinParameters, false);
                }
            }
        }
예제 #10
0
 public void RenderSky(HDCamera camera, Light sunLight, RTHandleSystem.RTHandle colorBuffer, RTHandleSystem.RTHandle depthBuffer, DebugDisplaySettings debugSettings, CommandBuffer cmd)
 {
     m_SkyRenderingContext.RenderSky(m_VisualSky, camera, sunLight, colorBuffer, depthBuffer, debugSettings, cmd);
 }
        public void RenderSky(SkyUpdateContext skyContext, HDCamera hdCamera, Light sunLight, RTHandleSystem.RTHandle colorBuffer, RTHandleSystem.RTHandle depthBuffer, DebugDisplaySettings debugSettings, CommandBuffer cmd)
        {
            if (skyContext.IsValid() && hdCamera.clearColorMode == HDAdditionalCameraData.ClearColorMode.Sky)
            {
                using (new ProfilingSample(cmd, "Sky Pass"))
                {
                    m_BuiltinParameters.commandBuffer             = cmd;
                    m_BuiltinParameters.sunLight                  = sunLight;
                    m_BuiltinParameters.pixelCoordToViewDirMatrix = HDUtils.ComputePixelCoordToWorldSpaceViewDirectionMatrix(hdCamera.camera.fieldOfView * Mathf.Deg2Rad, hdCamera.screenSize, hdCamera.viewMatrix, false);
                    m_BuiltinParameters.invViewProjMatrix         = hdCamera.viewProjMatrix.inverse;
                    m_BuiltinParameters.screenSize                = hdCamera.screenSize;
                    m_BuiltinParameters.cameraPosWS               = hdCamera.camera.transform.position;
                    m_BuiltinParameters.colorBuffer               = colorBuffer;
                    m_BuiltinParameters.depthBuffer               = depthBuffer;
                    m_BuiltinParameters.hdCamera                  = hdCamera;
                    m_BuiltinParameters.debugSettings             = debugSettings;

                    skyContext.renderer.SetRenderTargets(m_BuiltinParameters);

                    // If the luxmeter is enabled, we don't render the sky
                    if (debugSettings.lightingDebugSettings.debugLightingMode != DebugLightingMode.LuxMeter)
                    {
                        // When rendering the visual sky for reflection probes, we need to remove the sun disk if skySettings.includeSunInBaking is false.
                        skyContext.renderer.RenderSky(m_BuiltinParameters, false, hdCamera.camera.cameraType != CameraType.Reflection || skyContext.skySettings.includeSunInBaking);
                    }
                }
            }
        }
예제 #12
0
 public virtual void RenderDebugOverlay(Camera camera, ScriptableRenderContext renderContext, DebugDisplaySettings debugDisplaySettings, ref float x, ref float y, float overlaySize, float width)
 {
 }
예제 #13
0
 public virtual void RenderDeferredLighting(HDCamera hdCamera, ScriptableRenderContext renderContext,
                                            DebugDisplaySettings debugDisplaySettings,
                                            RenderTargetIdentifier[] colorBuffers, RenderTargetIdentifier depthStencilBuffer, RenderTargetIdentifier depthStencilTexture,
                                            bool outputSplitLightingForSSS)
 {
 }
예제 #14
0
        public void Init(RenderPipelineSettings settings, RenderPipelineResources resources, BlueNoise blueNoise, LightLoop lightloop, SharedRTManager sharedRTManager, DebugDisplaySettings currentDebugDisplaySettings)
        {
            // Keep track of the resources
            m_Resources = resources;

            // Keep track of the settings
            m_Settings = settings;

            // Keep track of the lightloop
            m_LightLoop = lightloop;

            // Keep track of the shared RT manager
            m_SharedRTManager = sharedRTManager;

            // Keep track of the blue noise manager
            m_BlueNoise = blueNoise;

            // Create the list of environments
            m_Environments = new List <HDRaytracingEnvironment>();

            // Grab all the ray-tracing graphs that have been created before (in case the order of initialization has not been respected, which happens when we open unity the first time)
            HDRaytracingEnvironment[] environmentArray = Object.FindObjectsOfType <HDRaytracingEnvironment>();
            for (int envIdx = 0; envIdx < environmentArray.Length; ++envIdx)
            {
                RegisterEnvironment(environmentArray[envIdx]);
            }

            // Init the ray count manager
            m_RayCountManager.Init(resources, currentDebugDisplaySettings);

#if UNITY_EDITOR
            // We need to invalidate the acceleration structures in case the hierarchy changed
            EditorApplication.hierarchyChanged += OnHierarchyChanged;
#endif
        }
        public void RenderSky(SkyUpdateContext skyContext, HDCamera hdCamera, Light sunLight, RTHandleSystem.RTHandle colorBuffer, RTHandleSystem.RTHandle depthBuffer, DebugDisplaySettings debugSettings, CommandBuffer cmd)
        {
            if (skyContext.IsValid() && hdCamera.clearColorMode == HDAdditionalCameraData.ClearColorMode.Sky)
            {
                using (new ProfilingSample(cmd, "Sky Pass"))
                {
                    m_BuiltinParameters.commandBuffer             = cmd;
                    m_BuiltinParameters.sunLight                  = sunLight;
                    m_BuiltinParameters.pixelCoordToViewDirMatrix = hdCamera.mainViewConstants.pixelCoordToViewDirWS;
                    m_BuiltinParameters.screenSize                = hdCamera.screenSize;
                    m_BuiltinParameters.colorBuffer               = colorBuffer;
                    m_BuiltinParameters.depthBuffer               = depthBuffer;
                    m_BuiltinParameters.hdCamera                  = hdCamera;
                    m_BuiltinParameters.debugSettings             = debugSettings;

                    skyContext.renderer.SetRenderTargets(m_BuiltinParameters);

                    // If the luxmeter is enabled, we don't render the sky
                    if (debugSettings.data.lightingDebugSettings.debugLightingMode != DebugLightingMode.LuxMeter)
                    {
                        // When rendering the visual sky for reflection probes, we need to remove the sun disk if skySettings.includeSunInBaking is false.
                        skyContext.renderer.RenderSky(m_BuiltinParameters, false, hdCamera.camera.cameraType != CameraType.Reflection || skyContext.skySettings.includeSunInBaking.value);
                    }
                }
            }
        }
        public void RenderSky(HDCamera camera, Light sunLight, RenderTargetIdentifier colorBuffer, RenderTargetIdentifier depthBuffer, CommandBuffer cmd, DebugDisplaySettings debugSettings)
        {
            using (new ProfilingSample(cmd, "Sky Pass"))
            {
                if (IsSkyValid())
                {
                    // Rendering the sky is the first time in the frame where we need fog parameters so we push them here for the whole frame.
                    m_SkySettings.atmosphericScatteringSettings.PushShaderParameters(cmd, debugSettings.renderingDebugSettings);

                    m_BuiltinParameters.commandBuffer             = cmd;
                    m_BuiltinParameters.sunLight                  = sunLight;
                    m_BuiltinParameters.pixelCoordToViewDirMatrix = ComputePixelCoordToWorldSpaceViewDirectionMatrix(camera.camera.fieldOfView * Mathf.Deg2Rad, camera.screenSize, camera.viewMatrix, false);
                    m_BuiltinParameters.invViewProjMatrix         = camera.viewProjMatrix.inverse;
                    m_BuiltinParameters.screenSize                = camera.screenSize;
                    m_BuiltinParameters.cameraPosWS               = camera.camera.transform.position;
                    m_BuiltinParameters.colorBuffer               = colorBuffer;
                    m_BuiltinParameters.depthBuffer               = depthBuffer;

                    m_Renderer.SetRenderTargets(m_BuiltinParameters);
                    m_Renderer.RenderSky(m_BuiltinParameters, false);
                }
            }
        }