Bootstrap

UnityShader 学习笔记 25 屏幕后期之Bloom效果

  • Shader:


Shader "_MyShader/9_PostScreenEffect/3_MyBloom"{

    Properties {

        _MainTex ("Base (RGB)", 2D) = "white" {}

            _Bloom ("Bloom (RGB)", 2D) = "black" {}

            _LuminanceThreshold ("Luminance Threshold", Float) = 0.5

            _BlurSize ("Blur Size", Float) = 1.0

    }

    SubShader {

        CGINCLUDE



        #include "UnityCG.cginc"



        sampler2D _MainTex;

        half4 _MainTex_TexelSize;

        sampler2D _Bloom;

        float _LuminanceThreshold;

        float _BlurSize;



        struct v2f {

            float4 pos : SV_POSITION; 

            half2 uv : TEXCOORD0;

        };    



        v2f vertExtractBright(appdata_img v) {

            v2f o;



            o.pos = mul(UNITY_MATRIX_MVP, v.vertex);



            o.uv = v.texcoord;



            return o;

        }



        fixed luminance(fixed4 col
;