1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
-
- Shader "Outlined/Post Outline"
- {
- Properties
- {
- _MainTex("Main Texture",2D) = "black"{}
- _SceneTex("Scene Texture",2D) = "black"{}
- }
- SubShader
- {
- Pass
- {
- CGPROGRAM
- sampler2D _MainTex;
-
- float2 _MainTex_TexelSize;
- #pragma vertex vert
- #pragma fragment frag
- #include "UnityCG.cginc"
- struct v2f
- {
- float4 pos : SV_POSITION;
- float2 uvs : TEXCOORD0;
- };
- v2f vert(appdata_base v)
- {
- v2f o;
-
- o.pos = UnityObjectToClipPos(v.vertex);
-
- o.uvs = o.pos.xy / 2 + 0.5;
- return o;
- }
- half frag(v2f i) : COLOR
- {
-
- int NumberOfIterations = 20;
-
- float TX_x = _MainTex_TexelSize.x;
-
- float ColorIntensityInRadius;
-
- for (int k = 0; k0)
- {
- return tex2D(_SceneTex,float2(i.uvs.x,1 - i.uvs.y));
- }
-
- for (int j = 0; j < NumberOfIterations; j += 1)
- {
-
- ColorIntensityInRadius += tex2D(
- _GrabTexture,
- float2(i.uvs.x,1 - i.uvs.y) + float2
- (
- 0,
- (j - NumberOfIterations / 2) * TX_y
- )
- ).r / NumberOfIterations;
- }
-
- half4 outcolor = ColorIntensityInRadius * half4(0,1,1,1) * 2 + (1 - ColorIntensityInRadius) * tex2D(_SceneTex,float2(i.uvs.x,1 - i.uvs.y));
- return outcolor;
- }
- ENDCG
- }
- }
-
- }
|