当前位置:网站首页>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
边栏推荐
- Two threads print odd and even numbers interactively
- SAP DEBUG调试FOR IN、REDUCE等复杂的语句
- keytool: command not found
- FSM finite state machine
- Moment. Format of format method function in JS
- Use of typescript dictionary
- 公共依赖模块common的处理
- 利用Lambda表达式解决c#文件名排序问题(是100大还是11大的问题)
- Mvcc (multi version concurrency control)
- 将单行文字自动适应到目标矩形框内
猜你喜欢

Implementation of MySQL persistence

Nacos / sentinel gateway current limiting and grouping (code)

keytool: command not found

Ogldev reading notes

Configure NPM

BTREE, B + tree and hash index

Reflect on the limitations of event bus and the design and implementation of communication mechanism in component development process

Page dynamic display time (upgraded version)

超级宝典&编程指南(红蓝宝书)-读书笔记

Authorization server (simple construction of authorization server)
随机推荐
keytool: command not found
ABAP 实现发布RESTful服务供外部调用示例
二叉树的深度
Game assisted script development journey
Solutions to common problems in visualization (VII) solutions to drawing scale setting
C#操作注册表全攻略
NodeJS(二)同步读取文件和异步读取文件
4. Multi table query
BTREE, B + tree and hash index
js之DOM事件
9. Common functions
Apache Hudi 如何加速传统的批处理模式?
C# 文本文件的查找及替换(WinForm)
'NPM' is not an internal or external command, nor is it a runnable program or batch file
Page dynamic display time (upgraded version)
VR、AR、MR的区别与应用,以及对AR技术的一些实现原理
快排的练习
js之节点操作,为什么要学习节点操作
系统与软件安全研究(二)
electron-builder打包报错:proxyconnect tcp: dial tcp :0: connectex