예제 #1
0
        public override void OnRenderImage(RenderTexture a, RenderTexture b)
        {
            this.UpdateTransform();

            var w = Screen.width >> ImageEffectBase.Level(this.Downsample);
            var h = Screen.height >> ImageEffectBase.Level(this.Downsample);

            var rt = RenderTexture.GetTemporary(w, h, 0, RenderTextureFormat.RGHalf, RenderTextureReadWrite.Linear);

            this.RenderVector(rt);

            if (this.Debug)
            {
                Graphics.Blit(rt, b);
            }
            else
            {
                this.Material.SetTexture("_Motion", rt);
                this.Material.SetFloat("_MotionScale", (1f / this.TargetFPS) / Time.deltaTime);

                Graphics.Blit(a, b, this.Material, 1);
            }

            RenderTexture.ReleaseTemporary(rt);
        }
예제 #2
0
        public override void OnRenderImage(RenderTexture a, RenderTexture b)
        {
            var i = ImageEffectBase.Level(this.Downsample);

            var w = a.width >> i;
            var h = a.height >> i;

            var rt = RenderTexture.GetTemporary(w, h, 0, RenderTextureFormat.ARGBHalf, RenderTextureReadWrite.Linear);

            this.Common.Threshold(a, rt, this.Threshold);
            this.Common.Blur(rt, this.BlurIterations, this.BlurSize / (float)(1 << i));

            this.Material.SetTexture("_LensColor", this.LensColor);
            this.Material.SetVector("_Params", new Vector3(this.Ghost, this.Halo, this.Distortion));

            var rt2 = this.Debug ? b : RenderTexture.GetTemporary(w, h, 0, RenderTextureFormat.ARGBHalf, RenderTextureReadWrite.Linear);

            base.OnRenderImage(rt, rt2);

            if (!this.Debug)
            {
                this.Common.Overlay(rt2, rt, Overlay.Multiply, this.LensDirt);

                RenderTexture.ReleaseTemporary(rt2);

                this.Common.Overlay(a, b, Overlay.Add, rt, this.Intensity);
            }

            RenderTexture.ReleaseTemporary(rt);
        }
예제 #3
0
        private void Awake()
        {
            var w = Screen.width >> ImageEffectBase.Level(this.Downsample);
            var h = Screen.height >> ImageEffectBase.Level(this.Downsample);

            this.thickness = new RenderTexture(w, h, 0, RenderTextureFormat.RHalf, RenderTextureReadWrite.Linear);

            Shader.SetGlobalTexture("_Thickness", this.thickness);
        }
예제 #4
0
        public override void OnRenderImage(RenderTexture a, RenderTexture b)
        {
            var i = ImageEffectBase.Level(this.Downsample);

            var w = a.width >> i;
            var h = a.height >> i;

            var rt = RenderTexture.GetTemporary(w, h, 0, RenderTextureFormat.ARGBHalf, RenderTextureReadWrite.Linear);

            this.Common.Threshold(a, rt, this.Threshold);
            this.Common.Blur(rt, this.BlurIterations, this.BlurSize / (float)(1 << i));

            if (this.Debug)
            {
                Graphics.Blit(rt, b);
            }
            else
            {
                this.Common.Overlay(a, b, Overlay.Add, rt, this.Intensity);
            }

            RenderTexture.ReleaseTemporary(rt);
        }