Exemple #1
0
        public void PushGlobalParams(HDCamera hdCamera, ScriptableRenderContext renderContext)
        {
            if (m_SkyManager.IsSkyValid())
            {
                m_SkyManager.SetGlobalSkyTexture();
                Shader.SetGlobalInt("_EnvLightSkyEnabled", 1);
            }
            else
            {
                Shader.SetGlobalInt("_EnvLightSkyEnabled", 0);
            }

            var cmd = new CommandBuffer {
                name = "Push Global Parameters"
            };

            cmd.SetGlobalVector("_ScreenSize", hdCamera.screenSize);
            cmd.SetGlobalMatrix("_ViewProjMatrix", hdCamera.viewProjectionMatrix);
            cmd.SetGlobalMatrix("_InvViewProjMatrix", hdCamera.invViewProjectionMatrix);

            renderContext.ExecuteCommandBuffer(cmd);
            cmd.Dispose();

            if (m_LightLoop != null)
            {
                m_LightLoop.PushGlobalParams(hdCamera.camera, renderContext);
            }
        }
Exemple #2
0
        public void PushGlobalParams(HDCamera hdCamera, ScriptableRenderContext renderContext, SubsurfaceScatteringParameters sssParameters)
        {
            if (m_SkyManager.IsSkyValid())
            {
                m_SkyManager.SetGlobalSkyTexture();
                Shader.SetGlobalInt("_EnvLightSkyEnabled", 1);
            }
            else
            {
                Shader.SetGlobalInt("_EnvLightSkyEnabled", 0);
            }

            // Broadcast SSS parameters to all shaders.
            Shader.SetGlobalInt("_TransmittanceFlags", sssParameters.transmittanceFlags);
            Shader.SetGlobalFloatArray("_ThicknessScales", sssParameters.thicknessScales);
            Shader.SetGlobalVectorArray("_HalfRcpVariancesAndLerpWeights", sssParameters.halfRcpVariancesAndLerpWeights);

            var cmd = new CommandBuffer {
                name = "Push Global Parameters"
            };

            cmd.SetGlobalVector("_ScreenSize", hdCamera.screenSize);
            cmd.SetGlobalMatrix("_ViewProjMatrix", hdCamera.viewProjectionMatrix);
            cmd.SetGlobalMatrix("_InvViewProjMatrix", hdCamera.invViewProjectionMatrix);

            renderContext.ExecuteCommandBuffer(cmd);
            cmd.Dispose();

            if (m_LightLoop != null)
            {
                m_LightLoop.PushGlobalParams(hdCamera.camera, renderContext);
            }
        }