<<<<<<<<<<<<<<<<<

Property(oscar) LYMB Property(oscar)

NAME

property - a collection of surface properties of a geometric object

DESCRIPTION

The property class holds all attributes that effect an objects appearance on the display. The majority of these attributes are the terms of the standard lighting equation:

p I = A a + L [ d cos(U) + s cos (V)]

Where I = computed intensity (color) of surface A = intensity of ambient light source (usually 1,1,1) L = intensity of point light source U = angle between surface normal and point light source V = angle between point light source reflection and viewpoint a = ambient coefficient d = diffuse coefficient s = specular coefficient p = specular power coefficient

Each component of the objects color goes through this equation to determine the final RGB components of the surface. The property class allows the user to set the values of the ambient, diffuse and specular coefficients as well as the value of the specular_power. Other attributes that do not play a roll in the lighting equation are also controlled through the property.

SUPERCLASS

object

INSTANCE VARIABLES

color The RGB components of the object's color.

ambient The ambient coefficient in the lighting equation. It can range from 0.0 (no ambient light added in) to 1.0 (add the full intensity of the ambient light source to the object's color).

diffuse The diffuse coefficient in the lighting equation. It can range from 0.0 (no diffuse component added in) to 1.0 (add the full intensity of the object's color to the computed color).

specular The specular coefficient in the lighting equation. It can range from 0.0 (no specular highlight) to 1.0 (add the full effect of specular highlighting

to the object's color).

specular_power The specular power coefficient in the lighting equation. A low value (~1) makes the specular highlight fall off slowly giving a dull, flat appearance. A larger value (~20-200) gives the surface a shinier appearance.

transparency The level of opaqueness of the object. A value of 0.0 makes the object completely transparent (you can't see it) and a value of 1.0 makes the object completely opaque (you can't see anything behind it).

interpolation The shading interpolation used when scan converting the surface. It controls whether the surface uses a flat, gouraud or phong model when being shaded.

representation The geometric representation of a surface. It can be represented as points (at each vertex), wireframe (lines between vertices of each polygonal element) or as a surface.

edge_visibility Flag to indicate whether the edge boundaries of 2D primitives (e.g., polygons and triangle strips) should be displayed. Has no effect on other primitives.

edge_color If edge visibility is on, the RGB components of the edges color.

MESSAGES

Although not mentioned explicitly, for each set message (such as ambient=), there is a corresponding get message (e.g., ambient?).

ambient[=+] amount Set/add the ambient coefficient.

ambient_color[=+] (r,g,b) Set/add the ambient color.

color[=+] (r,g,b) Set/add the object's color.

default! Reset the property values to the values in the property class.

diffuse[=+] Set/add the diffuse coefficient.

diffuse_color[=+] (r,g,b) Set/add the diffuse color.

edge_color[=+] Set/add the color of the edges.

edge_visibility_on! Set edge visibility on.

edge_visibility_off! Set edge visibility off.

flat! Set the interpolation model to flat. One color is computed for the polygon and it is drawn constant across its surface and edges.

gouraud! Set the interpolation model to gouraud. Colors are computed at each vertex and interpolated linearly across the surface.

interpolation= Set the interpolation value.

phong! Set the interpolation model to phong. Vertex normals are linearly interpolated across the surface and the lighting equation is invoked at each pixel.

points! Set the geometric representation to points. A pixel is set at each vertex.

specular[=+] Set/add the specular coefficient.

specular_color[=+] (r,g,b) Set/add the specular color.

specular_power[=+] Set/add the specular power coefficient.

surface! Set the geometric representation to surface. Every polygonal element is drawn with its interior filled in.

transparency[=+] Set/add the level of opaqueness.

wireframe! Set the geometric representation to wireframe.

Lines are drawn between the vertices of each polygonal element.

EXAMPLES

The following LYMB script creates a property object and sets some of its instance variables.

property new: shiny_metal color=(0.8, 0.8, 0.8) ambient=0.2 diffuse=0.8 specular=0.7 specular_power=50.0 phong! surface! ;

sphere_modeller new: sphere_mod resolution=4 ;

actor new: sphere modeller=sphere_mod property=shiny_metal ;

SEE ALSO

actor, light, renderer, (class)_modeller


Please send comments and suggestions to
consult@rpi.edu