当前位置:网站首页>编写PostEffect后期的shader
编写PostEffect后期的shader
2022-07-16 02:12:00 【刘培玉--大王】
如果之前在OnRenderImage写后期,经常会用cg去写后期。但是代码放到PostEffect中发现,就只有一个莫名其妙的三角。是因为,PostEffect中的uv计算,和pos计算与我们平时使用的方式不同。还有关于_Main
Tex的使用。
_MainTex在后期中的使用
OnRenderImage中,如果我们不在Properties中声明_MainTex属性时,是无法获取当前的RT的图的,必须要指定后才能获取,声明了属性时是可以获取到当前RT值,不需要特别指定。
但是在PostEffect中没有这个问题。
顶点和UV计算
//OnRenderImage中
o.pos = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
//-------POSTEffect中
o.pos = float4(v.vertex.xy, 0.0, 1.0);
o.uv = (v.vertex.xy + 1.0) * 0.5;
#if UNITY_UV_STARTS_AT_TOP
o.uv = o.uv * float2(1.0, -1.0) + float2(0.0, 1.0);
#endif
边栏推荐
- What is the function of GIS service platform for pipe network management?
- 模拟实现C语言中常用函数
- 我的两周年创作纪念日
- Summarize the differences between i++ and i++
- 自动推理的逻辑01
- What are the five common data types of redis? What is the corresponding data storage space? Take you to learn from scratch
- If the designer leaves, the iphone14 may become a brick, and using the iPhone is even more compelling
- En trois étapes, j'ai terminé MySQL en une journée, ce qui m'a permis d'obtenir l'offre de tmall en douceur.
- Power Bi ---- what is a measure?
- Luogu questionnaire - high accuracy
猜你喜欢

【对象头】查看对象占用字节

MySQL original field to hump naming

技术分享| 快对讲-5G对讲

Terraform命令行工具介紹、安裝、使用

Regular database backup Linux

Community summit pulsar summit old golden peak conference topic highlights exposure!

Excel-vba quick start (VII. Get cell objects)

Redis data structure practice, see how microblogging, wechat, shopping cart, lottery applet is used?

Jupyterab installation

Database system probability -- relational database
随机推荐
In three steps, I finished MySQL in one day, which made me win tmall offer smoothly
0714下午1,review,
初阶C语言 - 结构体
ThreadLocal夺命11连问 我实在扛不住呀
2022年成都/杭州/厦门/武汉产品经理认证招生简章(NPDP)
Interview question 04.06 Successor DFS plus auxiliary variable traversal
PostgreSQL每周人物采访
Installing MySQL on Linux
【微信小程序】简洁好用的icon(94/100)
Appium自动化测试基础 — webview操作(重点)
Regular database backup Linux
模拟实现C语言中常用函数
openEuler 知:常用网址
使用nlmeas对图像进行去噪
图片格式解析
Power Bi ---- what is a measure?
Openeuler knowledge: common website
Kettle【实践 01】Linux环境下使用Azkaban定时调用Kettle的KJB或KTR脚本实现自动化数据处理(完整流程实例分享:包含sql+ktr+shell+flow相关文件云资源)
WebRTC系列-Turn协议实现
Rebuild binary tree