VEXPlasticSHOP
From Odwiki
The VEX Plastic SHOP is a Shader Operator which uses the VEX Plastic SurfaceShader to compute the color of the surface.
The shader itself is quite simple
surface
plastic(
vector amb=1;
vector diff=1;
vector spec=1;
float rough=0.1;
)
{
vector nml;
nml = frontface(normalize(N), I);
Cf = amb * ambient();
Cf += diff * diffuse(nml);
Cf += spec * phong(nml, -normalize(I), 1.0/rough);
}
The inputs to the shader (which show up as parameters in the SHOP) are
- amb - The ambient response of the surface (tint for ambient light)
- diff - The diffuse response of the surface (tint for diffuse light)
- spec - The specular response of the surface (tint for specular light)
- rough - The surface roughness
The shader first computes a front-facing normal which is used for the lighting computations.
Each type of light (ambient, diffuse and specular) is then added to the produce the final output color.



