introduction to 3d game programming with dx11---chapter 7,exercise 3:
transforming Kd and Ks discrete functions like followingbefore using them in the pixel shader.
1 void FuncD(
in float d,
out float Out)
2 {
3 if(d <=
0.0)
4 Out =
0.4;
5 else if(d >
0.0 && d <=
0.5)
6 Out =
0.6;
7 else if(d >
0.5 && d <=
1.0)
8 Out =
1.0;
9 }
10 void FuncS(
in float s,
out float Out)
11 {
12 if(s >=
0.0 && s <=
0.1)
13 Out =
0.0;
14 else if(s >
0.1 && s <=
0.8)
15 Out =
0.5;
16 else if(s >
0.8 && s <=
1.0)
17 Out =
0.8;
18 }
转载于:https://www.cnblogs.com/zhkza99c/archive/2012/07/22/2603384.html
相关资源:ToonShader