当前位置:网站首页>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
边栏推荐
猜你喜欢

Simple random roll call lottery (written under JS)

Implementation of MySQL persistence

SAP pi / PO rfc2soap publishes RFC interface as WS example

canvas学习第一篇

Reflection on the systematic design of Android audio and video caching mechanism

js之DOM事件

The page displays the current time in real time

中间人环境mitmproxy搭建

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

js之预解析
随机推荐
将指定路径下的所有SVG文件导出成PNG等格式的图片(缩略图或原图大小)
Date对象(js内置对象)
系统与软件安全研究(二)
SAP PI / Po rfc2restful Publishing RFC interface as restful examples (proxy indirect)
Authorization server (simple construction of authorization server)
利用网页表格导出EXCEL表格加线框及表格内部间距的问题
SAP PI/PO rfc2Soap 发布rfc接口为ws示例
移动布局(flex布局、视口标签)
Ogldev reading notes
js之预解析
Xamarin版的C# SVG路径解析器
C# 多个矩形围成的多边形标注位置的问题
SAP 导出Excel文件打开显示:“xxx“的文件格式和扩展名不匹配。文件可能已损坏或不安全。除非您信任其来源,否则请勿打开。是否仍要打开它?
VR、AR、MR的区别与应用,以及对AR技术的一些实现原理
防抖和节流
BTREE, B + tree and hash index
Apache Hudi 如何加速传统的批处理模式?
8. Paging query
js中对象的三种创建方式
Custom time format (yyyy-mm-dd HH: mm: SS week x)