- 最后登录
- 2014-10-23
- 注册时间
- 2011-7-19
- 阅读权限
- 90
- 积分
- 81303
 
- 纳金币
- -1
- 精华
- 11
|
一个简单的色彩变换shader,
Shader "Custom/AlmostToonShader" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf Lambert
sampler2D _MainTex;
struct Input {
float2 uv_MainTex;
};
void surf (Input IN, inout SurfaceOutput o) {
float colors = 4;
half4 c = tex2D (_MainTex, IN.uv_MainTex);
c.r = floor(c.r*colors + 0.5)/colors;
c.g = floor(c.g*colors + 0.5)/colors;
c.b = floor(c.b*colors + 0.5)/colors;
o.Albedo = c.rgb;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}
转自unity3d8.com |
|