Пример #1
0
        private void PrepareBloomSampling(RenderTexture bloomTexture, BloomParameters bloomParams)
        {
            this.m_combinationMat.SetTexture("_BloomTexture", bloomTexture);
            Vector4 vector = default(Vector4);

            vector.x = ((bloomParams.intensity <= 0.0001f) ? 0.0001f : bloomParams.intensity);
            vector.y = bloomParams.brightness;
            this.m_combinationMat.SetVector("_BloomParameters", vector);
        }
Пример #2
0
 public PostProcessParameters()
 {
     bloomParams        = new BloomParameters();
     lensDirtParams     = new LensDirtParameters();
     cameraParams       = new CameraParameters();
     DoFParams          = new DepthOfFieldParameters();
     colorGradingParams = new ColorGradingParameters();
     preCalcValues      = new PreCalcValues();
     commonPostProcess  = new CommonPostProcess();
 }
Пример #3
0
 public PostProcessParameters()
 {
     this.bloomParams        = default(BloomParameters);
     this.lensDirtParams     = default(LensDirtParameters);
     this.cameraParams       = default(CameraParameters);
     this.DoFParams          = default(DepthOfFieldParameters);
     this.colorGradingParams = default(ColorGradingParameters);
     this.preCalcValues      = default(PreCalcValues);
     this.commonPostProcess  = default(CommonPostProcess);
 }
Пример #4
0
        private void PrepareBloomSampling(RenderTexture bloomTexture, BloomParameters bloomParams)
        {
            m_combinationMat.SetTexture("_BloomTexture", bloomTexture);

            Vector4 shaderParams = new Vector4();

            shaderParams.x = bloomParams.intensity > MinValue ? bloomParams.intensity : MinValue;
            shaderParams.y = bloomParams.brightness;
            m_combinationMat.SetVector("_BloomParameters", shaderParams);
        }
Пример #5
0
        public RenderTexture CreateBloomTexture(RenderTexture halfResSource, BloomParameters bloomParams)
        {
            distanceMultiplier = bloomParams.distanceMultiplier;
            if (numDownsamples != bloomParams.downsamples)
            {
                numDownsamples  = bloomParams.downsamples;
                m_bloomTextures = new RenderTexture[numDownsamples];
            }

            halfResSource.filterMode = FilterMode.Bilinear;
            RenderTextureFormat format = halfResSource.format;

            int width  = halfResSource.width;
            int height = halfResSource.height;

            for (int i = 0; i < numDownsamples; i++)
            {
                m_bloomTextures[i]            = RenderTexture.GetTemporary(width, height, 0, format);
                m_bloomTextures[i].filterMode = FilterMode.Bilinear;
                m_bloomTextures[i].wrapMode   = TextureWrapMode.Clamp;

                width  /= 2;
                height /= 2;
            }

            halfResSource.filterMode = FilterMode.Bilinear;
            RenderTexture input = halfResSource;

            m_bloomMat.SetFloat("_BloomDistanceMultiplier", bloomParams.distanceMultiplier);

            for (int i = 1; i < numDownsamples; i++)
            {
                Graphics.Blit(input, m_bloomTextures[i], m_bloomMat, 0);
                input = m_bloomTextures[i];
            }

            //ScionPostProcess.ActiveDebug.RegisterTextureForVisualization(halfResSource, false);

            for (int i = numDownsamples - 1; i > 1; i--)
            {
                Graphics.Blit(m_bloomTextures[i], m_bloomTextures[i - 1], m_bloomMat, 1);
            }

            m_bloomMat.SetFloat("_EnergyNormalizer", GetEnergyNormalizer(numDownsamples));
            Graphics.Blit(m_bloomTextures[1], m_bloomTextures[0], m_bloomMat, 2);

            return(m_bloomTextures[0]);
        }
Пример #6
0
        public RenderTexture CreateBloomTexture(RenderTexture halfResSource, BloomParameters bloomParams)
        {
            if (this.numDownsamples != bloomParams.downsamples)
            {
                this.numDownsamples  = bloomParams.downsamples;
                this.m_bloomTextures = new RenderTexture[this.numDownsamples];
            }
            halfResSource.filterMode = FilterMode.Bilinear;
            RenderTextureFormat format = halfResSource.format;
            int num  = halfResSource.width;
            int num2 = halfResSource.height;

            for (int i = 0; i < this.numDownsamples; i++)
            {
                this.m_bloomTextures[i]            = RenderTexture.GetTemporary(num, num2, 0, format);
                this.m_bloomTextures[i].filterMode = FilterMode.Bilinear;
                this.m_bloomTextures[i].wrapMode   = TextureWrapMode.Clamp;
                num  /= 2;
                num2 /= 2;
            }
            halfResSource.filterMode = FilterMode.Bilinear;
            RenderTexture source = halfResSource;

            for (int j = 1; j < this.numDownsamples; j++)
            {
                Graphics.Blit(source, this.m_bloomTextures[j], this.m_bloomMat, 0);
                source = this.m_bloomTextures[j];
            }
            for (int k = this.numDownsamples - 1; k > 1; k--)
            {
                Graphics.Blit(this.m_bloomTextures[k], this.m_bloomTextures[k - 1], this.m_bloomMat, 1);
            }
            this.m_bloomMat.SetFloat("_EnergyNormalizer", 1f / (float)this.numDownsamples);
            Graphics.Blit(this.m_bloomTextures[1], this.m_bloomTextures[0], this.m_bloomMat, 2);
            return(this.m_bloomTextures[0]);
        }