SURFACE_COEFFICIENTS(3G)
NAME
surface_coefficients, bf_surface_coefficients − select the ambient, diffuse and specular coefficients for filled area primitives, and backfacing elements of filled area primitives
SYNOPSIS
C Syntax:
void surface_coefficients(fildes,ka,kd,ks);
int fildes;
float ka,kd,ks;
void bf_surface_coefficients(fildes,ka,kd,ks);
int fildes;
float ka,kd,ks;
FORTRAN77 Syntax:
subroutine surface_coefficients(fildes,ka,kd,ks)
integer∗4 fildes
real ka,kd,ks
subroutine bf_surface_coefficients(fildes,ka,kd,ks)
integer∗4 fildes
real ka,kd,ks
Pascal Syntax:
procedure surface_coefficients(fildes:integer; ka,kd,ks:real);
procedure bf_surface_coefficients(fildes:integer; ka,kd,ks:real);
DESCRIPTION
Input Parameters
fildes Integer file descriptor returned by gopen when an I/O path to a graphics device is opened.
ka coefficient of ambient reflection
kd coefficient of diffuse reflection
ks coefficient of specular reflection
Discussion
The surface_coefficients subroutine specifies ambient, diffuse, and specular lighting constants for polygonal surfaces. bf_surface_coefficients specifies the same constants for backfacing shaded polygons. Its parameters are used to determine the intensity of backfacing shaded polygons. The use of surface coefficients on polygons and backfacing polygons is initiated by a call to shade_mode, turning shading on and to bf_control, turning on special handling for backfacing polygons.
The reflection coefficients defined here are multiplied by each of these terms and are used as a means to attenuate the contribution of various components. 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 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 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) |
DEFAULTS
ka = 1.0 kd = 1.0 ks = 1.0
SEE ALSO
bf_control(3G), fill_color(3G), interior_style(3G), perimeter_color(3G), surface_model(3G), Starbase Graphics Techniques.
Hewlett-Packard Company — May 11, 2021