DemoHut

Basic shading

In the simplest shading model, the outgoing radiance on a surface is the combination of diffuse radiance (following Lambert's law) and specular radiance of all light sources:

Lov=k=1nLdiff(k)+Lspec(k),Ldiff=cdiffπ×ELcosln,Lspec=m+88πcosmhncspec×ELcosln,

where

There are different implementations of this shading equation, regarding the frequency of evaluation:

Note that the "Phong" term above refers to "Phong shading", different from "(Blinn-)Phong reflection model", which describes a simplified shading equation and takes into account the ambient lights.

All demos have been tested on Microsoft Edge/macOS.