this code works on another project, but when i started new and added this, it renders everything up-side-down.
I took this originally from other image based effects and altered it.
Here is the Shader:
Shader "Hidden/Fade Effect" {
Properties {
_MainTex ("Base (RGB)", RECT) = "white" {}
_Fade("FadeAmount", Float ) = 1.0
}
SubShader {
Pass {
ZTest Always Cull Off ZWrite Off
Fog { Mode off }
CGPROGRAM
#pragma vertex vert_img
#pragma fragment frag
#pragma fragmentoption ARB_precision_hint_fastest
#include "UnityCG.cginc"
uniform samplerRECT _MainTex;
uniform float _Fade;
float4 frag (v2f_img i) : COLOR
{
float4 original = texRECT(_MainTex, i.uv);
float3 fade;
fade.rgb = _Fade * original.rgb;
float4 output;
output.rgb = fade.rgb;
output.a = original.a;
return output;
}
ENDCG
}
}
Fallback off
}
And here is the CS:
using UnityEngine;
[ExecuteInEditMode]
[AddComponentMenu("Image Effects/Fade")]
public class FadeEffect : ImageEffectBase {
public float fade = 1.0f;
// Called by camera to apply image effect
void OnRenderImage (RenderTexture source, RenderTexture destination) {
material.SetFloat( "_Fade", fade );
ImageEffects.BlitWithMaterial (material, source, destination);
}
}
I’m don’t completely understand these Unitys own shader things, but i’m learning.