一些有关Shader的记录

 

#pragma fragmentoption ARB_precision_hint_fastest    "+ Precision Hints (ARB_precision_hint_fastest, ARB_precision_hint_nicest)

Fragment program computations are carried out at an implementation-
dependent precision. However, some implementations may be able to perform
fragment program computations at more than one precision, and may be able
to trade off computation precision for performance.

If a fragment program specifies the "ARB_precision_hint_fastest" program
option, implementations should select precision to minimize program
execution time, with possibly reduced precision. If a fragment program
specifies the "ARB_precision_hint_nicest" program option, implementations
should maximize the precision, with possibly increased execution time.

Only one precision control option may be specified by any given fragment
program. A fragment program that specifies both the
"ARB_precision_hint_fastest" and "ARB_precision_hint_nicest" program
options will fail to load."

//

GLSL中纹理坐标Y方向的原点在顶部,而HLSL中纹理坐标Y方向的原点在底部,所以你需要使用这个公式uv.y = 1 – uv.y 对每个点重新定义纹理坐标。uv中的每一项和vertices中的每一项都是一一对应的​

在unity中,UV坐标划分,分下面两大步骤
1.  参考的标准是,unity刚导入时的那张图​,即原图
2.  原图的左下角uv坐标定为(0,0),原图的右上角的uv坐标定位(1,1)​,原图的其它任何一个位置按照比例都会有一个uv坐标,比如原图的左上角的uv坐标定位(0,1),原图的右下角的UV坐标定位(1,0),原图的中心(对角线的交点)位置为(0.5,0.5),等等​

所有有动画的图WrapMode不能设置成Clamp,可以设置Repeat
修改网格顶点纹理坐标的 Shader代码(TRANSFORM_TEX 宏的实现):
o.uv = v.uv * _MainTex_ST.xy + _MainTex_ST.zw;
// Transforms 2D UV by scale/bias property
#define TRANSFORM_TEX(tex,name) (tex.xy * name##_ST.xy + name##_ST.zw)

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值