본문 바로가기

개발/Graphics, Shader

난반사, 정반사, 주변광 (Diffuse, Specular, Ambient)

 

 

난반사 (Diffuse)

 

LightVector = normalize(Light.Position - Object.Position)
Diffuse = saturate(dot(LightVector, Normal)

 

 

 

정반사 (Specular)

 

LightVector = normalize(Object.Position - Light.Position)
Reflection = reflect(LightVector. Normal)
CameraVector = normalize(Camera.Positon - Object.Position)
Specular = pow(saturate(dot(Reflection, CameraVector)), SpecularPower);

 

 

 

주변광 (Ambient)

 

 

 

Diffuse + Specular + Ambient