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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#if UNITY_EDITOR
using UnityEngine;
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
public class RadialBlur : ImageEffectBase
{
public float blurStrength = 6.0f;
public float blurWidth = 0.7f;
void Awake()
{
enabled = false;
m_shaderName = "Hidden/radialBlur";
//if (!SystemInfo.supportsRenderTextures)
//{
// enabled = false;
// return;
//}
}
void OnEnable()
{
}
void OnRenderImage(RenderTexture source, RenderTexture dest)
{
// Create the accumulation texture
//if (accumTexture == null || accumTexture.width != source.width || accumTexture.height != source.height)
//{
// DestroyImmediate(accumTexture);
// accumTexture = new RenderTexture(source.width, source.height, 0);
// accumTexture.hideFlags = HideFlags.HideAndDontSave;
// Graphics.Blit(source, accumTexture);
//}
material.SetTexture("_MainTex", source);
material.SetFloat("_BlurStrength", blurStrength);
material.SetFloat("_BlurWidth", blurWidth);
material.SetFloat("_iHeight", 1);
material.SetFloat("_iWidth", 1);
//accumTexture.MarkRestoreExpected();
// Graphics.Blit(source, accumTexture, material);
// Graphics.Blit(accumTexture, dest);
Graphics.Blit(source, dest, material);
}
}
#endif
|