This repository has been archived on 2025-04-11. You can view files and clone it, but cannot push or open issues or pull requests.
project-undercover/Project Undercover/Assets/Scripts/Glow/GlowComposite.cs

24 lines
494 B
C#
Raw Permalink Normal View History

2017-10-03 04:15:13 -05:00
using UnityEngine;
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
public class GlowComposite : MonoBehaviour
{
[Range (0, 10)]
public float Intensity = 2;
private Material _compositeMat;
2017-10-03 13:36:57 -05:00
public Shader glowCompositeShader;
2017-10-03 04:15:13 -05:00
2017-10-03 13:36:57 -05:00
void OnEnable()
2017-10-03 04:15:13 -05:00
{
2017-10-03 13:36:57 -05:00
_compositeMat = new Material(glowCompositeShader);
2017-10-03 04:15:13 -05:00
}
void OnRenderImage(RenderTexture src, RenderTexture dst)
{
_compositeMat.SetFloat("_Intensity", Intensity);
Graphics.Blit(src, dst, _compositeMat, 0);
}
}