文章目录
高斯模糊的算法思路我就不再描述,自行百度。
效果1
- 效果1
- CSharp
- Shader
- 效果2
- CSharp
- 效果3
- CSharp
- Shader
- Project
- References
using UnityEngine;
public class GaussianBlurPP : MonoBehaviour
{
private static int _BlurSize_hash = Shader.PropertyToID("_BlurSize");
[Range(0, 4)]
public int iterations = 3;
[Range(0.2f, 3.0f)]
public float blurSpread = .6f;
[Range(1, 8)]
public int downSample = 2;
public Material mat;
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (mat == null)
{
Graphics.Blit(source, destination);
return;
}
var rw = Screen.width / downSample;
var rh = Screen.height / downSample;
var rt0 = RenderTexture.GetTemporary(rw, rh, 0);
rt0.filterMode = FilterMode.Bilinear;
// 先将远source复制到rt0,
Graphics.Blit(source, rt0);
for (int i = 0; i
关注
打赏
热门博文
- 3D Assets (Textures & Model & Animations) & Game Design Ideas & DCC Tutorials & TA
- LearnGL - 学习笔记目录
- Unity - Timeline 知识汇总
- Unity Graphics - 知识点目录 - 停止翻译,因为发现官方有中文文档了
- Graphic资料
- Unity Lightmap&LightProbe局部动态加载(亲测2020以及以上版本官方修复了)
- Unity - 踩坑日志 - 低版本线性颜色空间渲染异常的 “BUG”
- Unity Shader - PBR 渲染 SP 导出的素材
- 什么是 3A 游戏?
- Photosohp - 实现 2D MetaBall、MetaFont