VARKON Version 1.15 1997-10-24
shade_view - Procedure
Creates shaded images
Description
Creates a shaded image of the view in a window. Shading is based on a model where one or more (up to 8) concurrent light sources are used to view the (colored) B-planes or faceted surfaces of a model. The geometry of each lightsource can be configured individually, see light_vew(). Each light source shines with the intensity specified by the light_on() procedure and with the common color characteristics specified in the Varkon resource or ini file.
The total light from a light source is composed of ambient, diffuse and specular light. Ambient light hits all surfaces equally independant of their orientation. The reflection of diffuse light depends on the orientation of the surface relative to the direction of the light. A surface with a normal pointing towards the light becomes brighter and a surface with a normal far from the position of the light becomes darker. The reflection of specular light also takes the position of the viewer (eye position) and the material shininess factor into account to produce the effect of directly reflected light. Realistic images depend on good mixing between ambient, diffuse and specular light.
The result of shading also depends on the characetristics of the material used for the surfaces. Initially no materials are defined and the shader maps pen numbers to ordinary Varkon colors. The material_view() routine is used to create materials and link them to pen numbers. If a pen is linked to a material the shader will use the characteristics of the material instead of the ordinary color.
Syntax
shade_view(window,mode)
INT window; INT mode;
Principal parameters
None.
Optional parameters
window - Identity of graphical window to render. Default = 0 = main window. mode - 0 = flat shading, 1 = smooth shading. Default = 0 = flat
Comments
Smooth shading can result in better images when spotlights are used but requires more computation.