-
Notifications
You must be signed in to change notification settings - Fork 5
/
NotebookDrawingsFX.cs
35 lines (29 loc) · 893 Bytes
/
NotebookDrawingsFX.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using UnityEngine;
using System.Collections;
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
public class NotebookDrawingsFX : MonoBehaviour
{
public Texture noiseTexture;
public bool grid = true;
[Range(0.0f, 15.0f)]
public float vignette = 1.0f;
private Shader shader;
private Material material;
void Awake()
{
shader = Shader.Find("Hidden/Notebook Drawings");
if (shader == null)
{
Debug.LogError("'Notebook Drawings' shader is missing!");
return;
}
material = new Material(shader);
}
void OnRenderImage(RenderTexture source, RenderTexture destination)
{
material.SetTexture("_NoiseTex", noiseTexture);
material.SetVector("_Features", new Vector4(grid ? 1.0f : 0.0f, vignette, 0.0f, 0.0f));
Graphics.Blit(source, destination, material);
}
}