SURFACE_MODEL(3G)
NAME
surface_model − define surface light reflectance parameters for shaded polygon fill
SYNOPSIS
C Syntax:
void surface_model(fildes,specular,highlight,red,green,blue);
int fildes,specular,highlight;
float red,green,blue;
FORTRAN77 Syntax:
subroutine surface_model(fildes,specular,highlight,red,green,blue)
integer*4 fildes,specular,highlight
real red,green,blue
Pascal Syntax:
procedure surface_model(fildes,specular,highlight:integer;
red,green,blue:real);
DESCRIPTION
Input Parameters
fildes Integer file descriptor returned by gopen when an I/O path to a graphics device is opened.
specular If TRUE (1), specular reflections are calculated. If FALSE (0), they are not.
highlight Specular highlight power in the range of 1 to 16,383.
red, green, blue
Specular reflection coefficients in the range 0.0 to 1.0
Discussion
Surface_model specifies the specular light reflectance model of a polygonal surface. Its parameters are used to determine the intensity of shaded polygons. The use of the surface model on polygons is initiated by a call to shade_mode, turning shading on.
Specular reflection coefficients determine the color of the surface in the region of greatest specular reflection when reflecting a white light source. When modeling plastic surfaces the red, green and blue parameters will all be the same value as the specular reflection of most plastics is the color of the light source. This is generally not the case with metals.
When shading polygons, the basic light source computations consist of the sum of three separate components:
The energy due to ambient illumination:
Ea = (Rs)(Ia)
The energy due to diffuse reflection from a point source:
Ed = (SUM from j=1 to 8) (Rs)(Ip.j)(cos (i.j))
The energy due to specular reflection from a point source:
Es = (SUM from j=1 to 8) (W)(Ip.j)((cos (s.j)) ^ h)
Where:
Rs = Reflectance coefficient of the surface (RGB color set by fill_color)
Ia = Ambient illumination (RGB color set by light_ambient)
Ip = Point source illumination (RGB color set by light_source)
i = Incident angle of light source
W = Specular reflection coefficient (red, green, blue color set by surface_model)
s = Angle between viewpoint ray and reflected ray.
h = Specular highlight power is degree of shininess (highlight)
If specular is FALSE (0), Es is not calculated.
Reflectance coefficients can also be specified directly for each polygon vertex if vertex_format specifies red, green, blue per vertex.
DEFAULTS
specular = FALSE (0):specular reflections not calculated.
SEE ALSO
light_ambient(3G), light_source(3G), light_switch(3G), shade_mode(3G), vertex_format(3G),
Starbase Graphics Techniques.
Hewlett-Packard Company — May 11, 2021