surface_model(3G)
NAME
surface_model, bf_surface_model − define surface light reflectance parameters for shaded polygon fill, and for back-facing elements of shaded polygons
SYNOPSIS
C Syntax:
void surface_model(fildes,specular,highlight,red,green,blue);
int fildes,specular,highlight;
float red,green,blue;
void bf_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
subroutine bf_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);
procedure bf_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, and the bf_surface_model subroutine specifies the specular light reflectance of back-facing polygonal surfaces. Parameters are used to determine the intensity of shaded polygons and back-facing shaded polygons. The use of the surface model on polygons and back-facing polygons is initiated by a call to shade_mode, turning shading on, and to bf_control, turning on special handling for back-facing polygons.
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 = (ka)(Rs)(Ia)
The energy due to diffuse reflection from a point source, where n is device-dependent (see discussion in light_switch(3G) on the number of lights supported):
Ed = (kd)n∑j=1(Rs)(Ipj)(cos(ij))
The energy due to specular reflection from a point source, where n is device-dependent (see discussion in light_switch(3G) on the number of lights supported):
Es = (ks)n∑j=1(W)(Ipj)((cos(sj))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) |
| ka | = | Coefficient of ambient reflection |
| kd | = | Coefficient of diffuse reflection |
| ks | = | Coefficient of specular reflection |
| 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
bf_control(3G), fill_color(3G), interior_style(3G), light_ambient(3G), light_source(3G), light_switch(3G), perimeter_color(3G), shade_mode(3G), surface_coefficients(3G), vertex_format(3G), Starbase Graphics Techniques.
Hewlett-Packard Company — HP-UX Release 9.0: August 1992