C#代码:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GaoSiMouHu : MonoBehaviour {
//高斯模糊 正态分布
public Material mat;
public float radio=1f;//半径
public int downSample = 1;//分辨率进行缩放
public int iteration = 1;//迭代次数
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
RenderTexture rt1 = RenderTexture.GetTemporary(source.width >> downSample, source.height >> downSample, 0, source.format);
RenderTexture rt2 = RenderTexture.GetTemporary(source.width >> downSample, source.height >> downSample, 0, source.format);
Graphics.Blit(source, rt1);
for (int i = 0; i < iteration; i++)
{
mat.SetVector("_Offset", new Vector4(0, radio, 0, 0));
Graphics.Blit(rt1, rt2, mat);
mat.SetVector("_Offset", n