User Tools

Site Tools


tutorials:light-modeling-light-shader

This is an old revision of the document!


Local illumination - Shader

To set the optical properties of an object, in computer graphics the so-called local illumination model is used. It defines so-called shaders, that are define the amount of absorption, reflection and transmission and how the light rays are scattered. The values for absorption are obtained as the 'remaining radiation', i.e., the difference between reflectance and transmission, when we subtract the reflectance and transmission from the total of incoming radiation: Absorption = Total - Reflectance - Transmission.

Note: there is no check of plausibility implemented within the Phong shader. The user needs to make sure that the sum of reflectance and transmission is not higher than the actual incoming radiation. You cannot reflect or transmit more than what was incoming; otherwise, the object would be a light source emitting light.

Computer graphics knows several implementations of local illumination models. The most common are:

  • Labertian shader, and
  • Phong shader

Lambert Shader

tbd

Phong Shader

A Phong shader can be defined as following:

static Phong myShader = new Phong();
static {
  myShader.setDiffuse(new RGBAShader(0.1, 0.9, 0.0));
  myShader.setTransparency(new Graytone(0.3));
  myShader.setSpecular(new Graytone(0.1));
  myShader.setShininess(new Graytone(0.05));
}
 
protected void init () [
  Axiom ==> Box(0.001,1,1).(setShader(myShader));
]
tutorials/light-modeling-light-shader.1736624000.txt.gz · Last modified: 2025/01/11 20:33 by MH