コード例 #1
0
        public void Render(RenderTexture source, RenderTexture destination)
        {
            Material material = this.context.materialFactory.Get("Hidden/Post FX/Temporal Anti-aliasing");

            material.shaderKeywords = null;
            AntialiasingModel.TaaSettings taaSettings = base.model.settings.taaSettings;
            if (this.m_ResetHistory || this.m_HistoryTexture == null || this.m_HistoryTexture.width != source.width || this.m_HistoryTexture.height != source.height)
            {
                if (this.m_HistoryTexture)
                {
                    RenderTexture.ReleaseTemporary(this.m_HistoryTexture);
                }
                this.m_HistoryTexture      = RenderTexture.GetTemporary(source.width, source.height, 0, source.format);
                this.m_HistoryTexture.name = "TAA History";
                Graphics.Blit(source, this.m_HistoryTexture, material, 2);
            }
            material.SetVector(TaaComponent.Uniforms._SharpenParameters, new Vector4(taaSettings.sharpen, 0f, 0f, 0f));
            material.SetVector(TaaComponent.Uniforms._FinalBlendParameters, new Vector4(taaSettings.stationaryBlending, taaSettings.motionBlending, 6000f, 0f));
            material.SetTexture(TaaComponent.Uniforms._MainTex, source);
            material.SetTexture(TaaComponent.Uniforms._HistoryTex, this.m_HistoryTexture);
            RenderTexture temporary = RenderTexture.GetTemporary(source.width, source.height, 0, source.format);

            temporary.name = "TAA History";
            this.m_MRT[0]  = destination.colorBuffer;
            this.m_MRT[1]  = temporary.colorBuffer;
            Graphics.SetRenderTarget(this.m_MRT, source.depthBuffer);
            GraphicsUtils.Blit(material, (!this.context.camera.orthographic) ? 0 : 1);
            RenderTexture.ReleaseTemporary(this.m_HistoryTexture);
            this.m_HistoryTexture = temporary;
            this.m_ResetHistory   = false;
        }
コード例 #2
0
        // Token: 0x06003B34 RID: 15156 RVA: 0x001CAACC File Offset: 0x001C8ECC
        public void SetProjectionMatrix()
        {
            AntialiasingModel.TaaSettings taaSettings = base.model.settings.taaSettings;
            Vector2 vector = this.GenerateRandomOffset();

            vector *= taaSettings.jitterSpread;
            this.context.camera.nonJitteredProjectionMatrix = this.context.camera.projectionMatrix;
            this.context.camera.projectionMatrix            = ((!this.context.camera.orthographic) ? this.GetPerspectiveProjectionMatrix(vector) : this.GetOrthographicProjectionMatrix(vector));
            this.context.camera.useJitteredProjectionMatrixForTransparentRendering = false;
            vector.x /= (float)this.context.width;
            vector.y /= (float)this.context.height;
            Material material = this.context.materialFactory.Get("Hidden/Post FX/Temporal Anti-aliasing");

            material.SetVector(TaaComponent.Uniforms._Jitter, vector);
        }