Beispiel #1
0
        public void RenderSky(HDCamera camera, Light sunLight, RenderTargetIdentifier colorBuffer, RenderTargetIdentifier depthBuffer, CommandBuffer cmd)
        {
            using (new Utilities.ProfilingSample("Sky Pass", cmd))
            {
                if (IsSkyValid())
                {
                    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.cameraPosWS               = camera.camera.transform.position;
                    m_BuiltinParameters.colorBuffer               = colorBuffer;
                    m_BuiltinParameters.depthBuffer               = depthBuffer;

                    m_Renderer.SetRenderTargets(m_BuiltinParameters);
                    m_Renderer.RenderSky(m_BuiltinParameters, skySettings, false);
                }
            }
        }
        public void RenderSky(HDCamera camera, Light sunLight, RenderTargetIdentifier colorBuffer, RenderTargetIdentifier depthBuffer, CommandBuffer cmd)
        {
            using (new Utilities.ProfilingSample("Sky Pass", cmd))
            {
                if (IsSkyValid())
                {
                    m_BuiltinParameters.commandBuffer     = cmd;
                    m_BuiltinParameters.sunLight          = sunLight;
                    m_BuiltinParameters.invViewProjMatrix = camera.viewProjMatrix.inverse;
                    m_BuiltinParameters.cameraPosWS       = camera.camera.transform.position;
                    m_BuiltinParameters.screenSize        = camera.screenSize;
                    m_BuiltinParameters.skyMesh           = BuildSkyMesh(camera.camera.GetComponent <Transform>().position, m_BuiltinParameters.invViewProjMatrix);
                    m_BuiltinParameters.colorBuffer       = colorBuffer;
                    m_BuiltinParameters.depthBuffer       = depthBuffer;

                    m_Renderer.SetRenderTargets(m_BuiltinParameters);
                    m_Renderer.RenderSky(m_BuiltinParameters, skySettings, false);
                }
            }
        }
Beispiel #3
0
        public void RenderSky(HDCamera camera, Light sunLight, RenderTargetIdentifier colorBuffer, RenderTargetIdentifier depthBuffer, ScriptableRenderContext renderContext)
        {
            using (new Utilities.ProfilingSample("Sky Pass", renderContext))
            {
                if (IsSkyValid())
                {
                    m_BuiltinParameters.renderContext     = renderContext;
                    m_BuiltinParameters.sunLight          = sunLight;
                    m_BuiltinParameters.invViewProjMatrix = camera.invViewProjectionMatrix;
                    m_BuiltinParameters.cameraPosWS       = camera.camera.transform.position;
                    m_BuiltinParameters.screenSize        = camera.screenSize;
                    m_BuiltinParameters.skyMesh           = BuildSkyMesh(camera.camera.GetComponent <Transform>().position, m_BuiltinParameters.invViewProjMatrix, false);
                    m_BuiltinParameters.colorBuffer       = colorBuffer;
                    m_BuiltinParameters.depthBuffer       = depthBuffer;

                    m_Renderer.SetRenderTargets(m_BuiltinParameters);
                    m_Renderer.RenderSky(m_BuiltinParameters, skyParameters, false);
                }
            }
        }
Beispiel #4
0
        public void RenderSky(HDCamera camera, Light sunLight, RenderTargetIdentifier colorBuffer, RenderTargetIdentifier depthBuffer, CommandBuffer cmd, FrameSettings m_frameSettings)
        {
            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, m_frameSettings);

                    m_BuiltinParameters.commandBuffer             = cmd;
                    m_BuiltinParameters.sunLight                  = sunLight;
                    m_BuiltinParameters.pixelCoordToViewDirMatrix = HDUtils.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);
                }
            }
        }