当前位置:网站首页>SampleCameraFilter
SampleCameraFilter
2022-04-23 07:46: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://yzsam.com/2022/04/202204230626191528.html
边栏推荐
- Authorization+Token+JWT
- Use of typescript dictionary
- Apache Hudi 如何加速传统的批处理模式?
- SAP SALV14 后台输出SALV数据可直接保存文件,发送Email(带排序、超链接、筛选格式)
- 设置了body的最大宽度,但是为什么body的背景颜色还铺满整个页面?
- SAP 导出Excel文件打开显示:“xxx“的文件格式和扩展名不匹配。文件可能已损坏或不安全。除非您信任其来源,否则请勿打开。是否仍要打开它?
- Understanding of STL container
- SAP PI / Po rfc2restful Publishing RFC interface as restful examples (proxy indirect)
- 移动端布局(3D转换、动画)
- Custom time format (yyyy-mm-dd HH: mm: SS week x)
猜你喜欢
How to judge whether a point is within a polygon (including complex polygons or a large number of polygons)
页面实时显示当前时间
js之什么是事件?事件三要素以及操作元素
Django uses MySQL database to solve error reporting
中间人环境mitmproxy搭建
Custom time format (yyyy-mm-dd HH: mm: SS week x)
FSM finite state machine
C# 多个矩形围成的多边形标注位置的问题
keytool: command not found
SAP PI/PO rfc2RESTful 发布rfc接口为RESTful示例(Proxy间接法)
随机推荐
Thorough inquiry -- understanding and analysis of cocos2d source code
Design optimization of MySQL database
King glory - unity learning journey
C# SmoothProgressBar自定义进度条控件
Ogldev reading notes
踩坑日记:Unable to process Jar entry [module-info.class]
自己封装unity的Debug函数
ABAP 7.4 SQL Window Expression
SAP 导出Excel文件打开显示:“xxx“的文件格式和扩展名不匹配。文件可能已损坏或不安全。除非您信任其来源,否则请勿打开。是否仍要打开它?
instanceof的实现原理
SAP TRANSLATE使用数据对象掩码示例
Super classic & Programming Guide (red and blue book) - Reading Notes
2. Restricted query
What are the total number of all courses of Mr. Tang Xiaoyang, who is very popular in CSDN (question mark)
js之自定义属性以及H5中如何判断自定义属性
事件管理之一
基于NLP的软件安全研究(一)
Mongodb 启动警告信息处理
js中对象的三种创建方式
利用Lambda表达式解决c#文件名排序问题(是100大还是11大的问题)