## GAIA LABORATORY FOR GRAPHICS

Department of Game and Multimedia Engineering

# openGL CG 系列教程07 – Toon Shader

*原创文章，转载请注明出处*

openGL CG 系列教程07 – Toon Shader

Fig2  NdotL值分布

 float3 N = normalize(normal); float3 L = normalize(LightPosition - Position); float NdotL = max(dot(N,L),0);   float3 color;   if( NdotL<0.5)    color = float3(0.3,0.3,0.3); else if(NdotL>=0.5 && NdotL<0.85)    color = diffuseColor; else if(NdotL>=0.85)    color = specularColor;

Fig3 法线N和观察向量V

 float3 N = normalize(normal); float3 L = normalize(LightPosition - Position); float3 V = normalize(eyePosition - P); float NdotL = max(dot(N,L),0); float NdotV = max(dot(N,V),0);   float3 color;   if( NdotL<0.5)    color = float3(0.3,0.3,0.3); else if(NdotL>=0.5 && NdotL<0.85)    color = diffuseColor; else if(NdotL>=0.85)    color = specularColor;   if(NdotV<0.2)    color = float3(0,0,0);

*原创文章，转载请注明出处*

2017-11-28 16:19:22

#### openGL CG 系列教程1 - Hello CG

2010-04-28 19:46:00

2006-09-10 17:13:00

2018-02-02 19:18:11

2018年03月23日 1.32MB 下载

#### Cg入门11：Vertex Shader - 几何变换 —MVP矩阵变换（旋转、缩放）

2016-03-23 16:17:11

#### OpenGL&CG技术之Render To Texture

2015-12-26 14:21:02

#### openGL Cg Sample

2009年03月10日 3.64MB 下载