Vuforia Alaph Shader
来源:互联网 发布:c4d r16 mac 注册机 编辑:程序博客网 时间:2024/06/08 06:36
Shader "Unlit/Transparent Chroma" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
_MaskCol ("Mask Color", Color) = (1.0, 0.0, 0.0, 1.0)
_Sensitivity ("Threshold Sensitivity", Range(0,1)) = 0.5
_Smooth ("Smoothing", Range(0,1)) = 0.5
}
SubShader {
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
LOD 100
ZTest Always Cull Back ZWrite On Lighting Off Fog { Mode off }
CGPROGRAM
#pragma surface surf Lambert alpha
struct Input {
float2 uv_MainTex;
};
sampler2D _MainTex;
float4 _MaskCol;
float _Sensitivity;
float _Smooth;
void surf (Input IN, inout SurfaceOutput o) {
half4 c = tex2D (_MainTex, IN.uv_MainTex);
float maskY = 0.2989 * _MaskCol.r + 0.5866 * _MaskCol.g + 0.1145 * _MaskCol.b;
float maskCr = 0.7132 * (_MaskCol.r - maskY);
float maskCb = 0.5647 * (_MaskCol.b - maskY);
float Y = 0.2989 * c.r + 0.5866 * c.g + 0.1145 * c.b;
float Cr = 0.7132 * (c.r - Y);
float Cb = 0.5647 * (c.b - Y);
float blendValue = smoothstep(_Sensitivity, _Sensitivity + _Smooth, distance(float2(Cr, Cb), float2(maskCr, maskCb)));
o.Alpha = 1.0 * blendValue;
o.Emission = c.rgb * blendValue;
}
ENDCG
}
FallBack "Diffuse"
}
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
_MaskCol ("Mask Color", Color) = (1.0, 0.0, 0.0, 1.0)
_Sensitivity ("Threshold Sensitivity", Range(0,1)) = 0.5
_Smooth ("Smoothing", Range(0,1)) = 0.5
}
SubShader {
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
LOD 100
ZTest Always Cull Back ZWrite On Lighting Off Fog { Mode off }
CGPROGRAM
#pragma surface surf Lambert alpha
struct Input {
float2 uv_MainTex;
};
sampler2D _MainTex;
float4 _MaskCol;
float _Sensitivity;
float _Smooth;
void surf (Input IN, inout SurfaceOutput o) {
half4 c = tex2D (_MainTex, IN.uv_MainTex);
float maskY = 0.2989 * _MaskCol.r + 0.5866 * _MaskCol.g + 0.1145 * _MaskCol.b;
float maskCr = 0.7132 * (_MaskCol.r - maskY);
float maskCb = 0.5647 * (_MaskCol.b - maskY);
float Y = 0.2989 * c.r + 0.5866 * c.g + 0.1145 * c.b;
float Cr = 0.7132 * (c.r - Y);
float Cb = 0.5647 * (c.b - Y);
float blendValue = smoothstep(_Sensitivity, _Sensitivity + _Smooth, distance(float2(Cr, Cb), float2(maskCr, maskCb)));
o.Alpha = 1.0 * blendValue;
o.Emission = c.rgb * blendValue;
}
ENDCG
}
FallBack "Diffuse"
}
0 0
- Vuforia Alaph Shader
- Vuforia.
- Vuforia Features Vuforia特点
- shader
- shader
- shader
- Shader
- Shader
- shader
- shader
- shader
- Shader
- shader
- Shader
- shader
- Shader
- shader
- Shader
- html向flash传递参数
- MySQL忘记密码怎么办
- [20]枚举
- 今日学习札记——数据结构基础(11.7)
- QqChat.java
- Vuforia Alaph Shader
- Direct3D 中绘制二维图像
- Vim插件管理利器——Vundle
- Xen I/O虚拟化原理——Xen下总线、设备和驱动
- IOS 的 plist方法 好记性不如看博客
- 利用VPN实现android免root防火墙的方法
- android svg
- 错误:Error Domain=NSCocoaErrorDomain Code=3840 "Garbage at end." UserInfo={NSDebugDescription=Garbage
- 深入理解Xfermode,使用时要注意以及顺便膜拜下saveLayer的强大