当前位置:网站首页>SampleCameraFilter
SampleCameraFilter
2022-04-23 06:27:00 【老少年】
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof(Camera))/*,ExecuteInEditMode*/]
public class SampleCameraFilter : MonoBehaviour {
public RenderTexture rt;
//src和des是引擎创建的对象,我们只能使用,但是不要自己引用到本地。
private void OnRenderImage(RenderTexture src, RenderTexture des)
{
Graphics.Blit(src, des);//这一句一定要有,保证画面传递下去。不然会中断camera画面,别的滤镜会失效。
//这里要拷贝渲染出一张rt
if (rt == null)
{
rt = RenderTexture.GetTemporary(src.width, src.height);//unity自己在维护一个RenderTexture池,我们从缓存中取就行。
}
Graphics.Blit(src,rt);//拷贝图像
}
private void OnDestroy()
{
if (rt != null)
{
RenderTexture.ReleaseTemporary(rt);//记得释放引用
}
}
}
版权声明
本文为[老少年]所创,转载请带上原文链接,感谢
https://blog.csdn.net/laoshaonian/article/details/85064006
边栏推荐
猜你喜欢
页面实时显示当前时间
SAP DEBUG调试FOR IN、REDUCE等复杂的语句
Nacos / sentinel gateway current limiting and grouping (code)
‘npm‘不是内部或外部命令,也不是可运行的程序 或批处理文件
FSM finite state machine
王者荣耀-unity学习之旅
Reflect on the limitations of event bus and the design and implementation of communication mechanism in component development process
The page displays the current time in real time
Django uses MySQL database to solve error reporting
ogldev-读书笔记
随机推荐
MySQL index
对复杂字典Dictionary<T1,T2>排序问题
简易随机点名抽奖(js下编写)
SAP PI/PO rfc2RESTful 发布rfc接口为RESTful示例(Proxy间接法)
快速排序
Solutions to common problems in visualization (VII) solutions to drawing scale setting
The page displays the current time in real time
14. Transaction processing
Authorization+Token+JWT
ABAP CDS VIEW WITH ASSOCIATION示例
8. Paging query
事件管理之一
对js中argumens的简单理解
Date对象(js内置对象)
Two threads print odd and even numbers interactively
js之什么是事件?事件三要素以及操作元素
Understanding of STL container
移动Web(字体图标、平面转换、颜色渐变)
Authorization server (simple construction of authorization server)
Page dynamic display time (upgraded version)