Created
September 23, 2018 04:46
-
-
Save JeOam/30efe6861a78ed23ef0e6252cb82fb9b to your computer and use it in GitHub Desktop.
Unity Shader Notes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sampler2D myTex;
float4 myTex_ST; // 附带的一个变量
// ...
float2 tiling = myTex_ST.xy; // 放大缩小的倍数
float2 offset = myTex_ST.zw; // 位移
float4 o = tex2D(myTex, i.uv * tiling + offset)
return o
图片变灰:由于视觉感光对 R,G, B 的敏感度不一样,所以取不同的权重。
float4 grayScale(float4 v) {
float g = v.r * 0.299 + v.g * 0.578 + v.b * 0.114;
return float4(g, g, g, v.a);
}
if (w < 0) w = 0;
if (w > 1) w = 1;
// 等于
w = clamp(w, 0, 1);
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Holographic Effect: