Unity Image Effect
1.工作原理
Image Effect是运用于一个Camera,将Camera视见体最终看到的二维图像内容作为一个2DTexture传递给一个Shader,
然后在Shader的Fragment渲染阶段对这个Texture做逐像素处理。
2.应用框架
2.1一个用于Camera的C#脚本, 脚本定义一个Material 变量用于和Shader关联在一起,然后要实现OnRenderImage接口,
一般OnRenderImage中只做一件事,就是将Shader处理后的内容直接Blit到最终要渲染到Screen的另一个Texture、如下面代码
的第6或者第10行。
void OnRenderImage(RenderTexture srcTexture, RenderTexture dstTexture)
{
if(curShader != null)
{
material.SetFloat("_DepthPower", depthPower);
Graphics.Blit(srcTexture,dstTexture,material);
}
else
{
Graphics.Blit(srcTexture, dstTexture);
}
}
2.2一个关联C#脚本和Shader的Material对象。
2.3Shader
主要的功能代码都是在fixed4 frag(v2f_img i) : COLOR
Unity Image Effect的更多相关文章
- Unity Twist Effect Black Hole
Shader "Hidden/Twist Effect" {Properties { _MainTex ("Base (RGB)", 2D) = "w ...
- Unity全屏模糊
先上效果,左边模糊 其实用的是Unity Stard Effect里的资源,一个脚本一个shader //脚本代码 using UnityEngine; using System.Collection ...
- Unity Shader 基础(2) Image Effect
Unity中 Image Effect 是Post Processing的一种方,Unity自身也提供很多Effect效果供使用.Image Effect的使用官方文档做了很多介绍,这里重点Post ...
- Unity Shader Graph(二)Dissolve Effect
此篇文章记录Dissolve Effect(溶解特效)的制作过程 软件环境 Unity 2018.1.2f1 Packages: Lightweight Render Pipeline 1.1.11 ...
- unity, 在image effect shader中用_CameraDepthTexture重建世界坐标
--------------更新 更简单的方法: //depth: raw depth, nonlinear, 0 at near plane, 1 at far plan float4 scre ...
- Unity Shader入门精要之 screen post-processing effect
本篇记录了学习Unity Shader入门精要的屏幕后处理的一些知识点. OnRenderImage(RenderTexture src, RenderTexture dest) 以上函数是Unity ...
- 在Unity中使用UGUI修改Mesh绘制几何图形
在商店看到这样一个例子,表示很有兴趣,他们说是用UGUI做的.我想,像这种可以随便变形的图形,我第一个就想到了网格变形. 做法1: 细心的朋友应该会发现,每个UGUI可见元素,都有一个‘Canvas ...
- Unity 特殊文件夹 : 位置不能随便放
有以下几个文件夹: Assets 用来存放资源的文件夹,包括各种材质.模型等 Editor 编辑器类等脚本 Editor Default Resources Editor scripts can ma ...
- [Unity3D]Unity资料大全免费分享
都是网上找的连七八糟的资料了,整理好分享的,有学习资料,视频,源码,插件……等等 东西比较多,不是所有的都是你需要的,可以按 ctrl+F 来搜索你要的东西,如果有广告,不用理会,关掉就可以了,如 ...
随机推荐
- Jenkins学习总结(5)——免费DevOps开源工具简介
一:开发工具 1.版本控制系统 Git Git是一个开源的分布式版本控制系统,用以有效.高速的处理从很小到非常大的项目版本管理. 2.代码托管平台 GitLab GitLab是一个利用Ruby on ...
- C++实现页码数字统计
#include<iostream> #include<iomanip> #include<cstdlib> #include<ctime> #incl ...
- Aizu - 2305 Beautiful Currency (二分 + DFS遍历)
F. Beautiful Currency Time Limit: 5000ms Case Time Limit: 5000ms Memory Limit: 65536KB 64-bit intege ...
- I hate it (线段树)
B - I Hate It Time Limit:3000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submi ...
- 实现 jstl标签foreach 功能
jsp 页面 <%@ page language="java" contentType="text/html; charset=UTF-8" pageEn ...
- Darwin流媒体server在windows下搭建
简单介绍 主页: http://dss.macosforge.org/ Darwin Streaming Server (DSS) is an open sourceproject intende ...
- UVA 11077 Find the Permutations 递推置换
Find the Permutations Sorting is one of the most used operations in real ...
- Forms authentication timeout vs sessionState timeout
https://stackoverflow.com/questions/17812994/forms-authentication-timeout-vs-sessionstate-timeout Th ...
- 循环访问 TreeView 控件的所有节点
创建测试每个节点的递归过程 . private void PrintRecursive(TreeNode treeNode) { // Print the node. System.Diagnosti ...
- 大神js总结
http://www.cnblogs.com/tylerdonet/p/5543813.html http://www.codesec.net/list/8/