You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CrowdControl/Assets/Top Down/tools scripts/desaturate/Image Based/DesaturateEffect.cs

19 lines
653 B
C#

2 months ago
using UnityEngine;
[ExecuteInEditMode]
[AddComponentMenu("Image Effects/Desaturate")]
public class DesaturateEffect : ImageEffectBase {
public float desaturateAmount;
public Texture textureRamp;
public float rampOffsetR;
public float rampOffsetG;
public float rampOffsetB;
// Called by camera to apply image effect
void OnRenderImage (RenderTexture source, RenderTexture destination) {
material.SetTexture("_RampTex", textureRamp);
material.SetFloat("_Desat", desaturateAmount);
material.SetVector("_RampOffset", new Vector4 (rampOffsetR, rampOffsetG, rampOffsetB, 0));
ImageEffects.BlitWithMaterial(material, source, destination);
}
}