Ejemplo n.º 1
0
        public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
        {
            Camera camera = renderingData.cameraData.camera;

            if (!m_TAADatas.ContainsKey(camera))
            {
                m_TAADatas.Add(camera, new TAAData());
            }

            TAAData data  = m_TAADatas[camera];
            var     stack = VolumeManager.instance.stack;
            TemporalAntiAliasing temporalAntiAliasing = stack.GetComponent <TemporalAntiAliasing>();

            if (temporalAntiAliasing == null)
            {
#if UNITY_EDITOR
                Debug.LogWarning("Need add TemporalAntiAliasing component");
#endif
            }
            UpdateCameraInfos(ref renderingData, data, temporalAntiAliasing);

            m_CameraJitterPass.Setup(data);
            m_VelocityPass.Setup(data);
            m_TemporalReprojectionPass.Setup(data);
        }
Ejemplo n.º 2
0
        private void UpdateCameraInfos(ref RenderingData renderingData, TAAData data, TemporalAntiAliasing temporalAntiAliasing)
        {
            Camera camera = renderingData.cameraData.camera;

            data.prevViewMatrix       = m_PrevViewMatrix;
            data.prevProjectionMatrix = m_PrevProjectionMatrix;
            Vector2 offset = Utils.Sample();

            data.jitteredProjectionMatrix = camera.orthographic ?
                                            Utils.GetJitteredOrthographicProjectionMatrix(camera, offset) :
                                            Utils.GetJitteredPerspectiveProjectionMatrix(camera, offset);

            m_PrevViewMatrix       = camera.worldToCameraMatrix;
            m_PrevProjectionMatrix = camera.projectionMatrix;
        }