Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ sbrr(3G) — PersonalVisualizer 2.11

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

starbase(3G)

sbdl(3G)

cc(1)

pc(1)

fc(1)

ld(1)

SBRR(3G)

NAME

SBRR − Starbase Radiosity and Ray Tracing Library description

DESCRIPTION

The Starbase Radiosity and Ray Tracing library (SBRR) provides procedures for creating highly realistic graphic images with radiosity and ray tracing algorithms.  These library routines can be used in C, Pascal and FORTRAN77 programs. 

Radiosity and ray tracing are global rendering algorithms that consider the interaction of all objects in an environment when calculating the shading for an image.  Thus, globally-rendered images can exhibit accurate shadowing, reflection, and refraction effects not possible with non-global images. 

Radiosity is best suited for rendering environments made up of diffuse surfaces, accurately modeling the soft-edged shadows and color bleeding effects that occur in such scenes.  If the display hardware allows, radiosity images can also contain specular reflections and texture mapping effects.  Radiosity images are correctly shaded for any point of view, and so once computed, may be quickly viewed from any angle or position.  The computation process itself takes place in a series of steps in which the image is progressively refined and improved in quality.  Since the radiosity image can be displayed after any step of the solution without disrupting the computation process, it is possible to preview rendering results early in the rendering process or to control the level of quality (as well as the computation time) for particular images. 

Ray tracing accurately models the reflection, refraction, shadowing, and transparency effects characteristic of non-diffuse surfaces (glass, chrome, etc.).  The SBRR ray tracer uses optimization techniques such as ray tree controls to reduce computation times.  Ray tracing output may also be anti-aliased and, if supported by the display hardware, texture mapped to further improve image quality. 

The SBRR tools allow the programmer to prepare Starbase Display List segments for rendering by either a progressive radiosity or a ray tracing algorithm, compute the desired rendering, and output the computed image to an appropriate device. 

Display list segments that can be successfully rendered with standard Starbase lighting models provide a good base for constructing a model that will work well with the SBRR renderers.  Shadow_switch(3G), surf_global_model(3G), surf_illum_quality(3G), surf_light_model(3G), and surf_shading_resolution(3G) calls can be added to a model segment to set primitive attributes that affect only the global renderers.  Surf_global_model, for example, sets light reflection, transmission, and refraction parameters for subsequent surface primitives.  Bf_surf_global_model and bf_surf_light_model are included to set rendering attributes for backfacing surfaces. 

SBRR also provides three spline-surface primitives, spline_cone(3G), spline_sphere(3G), and spline_torus(3G), that can be used in any Starbase application. 

Before a model segment can be rendered, it must be associated with a control structure or scene that is used to allocate system resources and set control parameters for each rendering computation.  Create_scene(3G), delete_scene(3G), and inq_scene(3G) manage creation and deletion of scenes, while set_cond_index_mode(3G), set_rad_ambient_mode(3G), set_ray_aa_parms(3G), set_ray_output(3G), and set_ray_tree_parms(3G) set the parameters that control how each rendering job is processed. 

The actual rendering computations are performed by render_scene(3G).  Arguments to this procedure determine whether a radiosity image or a ray tracing is computed. 

Output of the computed rendering is controlled by output_scene(3G).  Radiosity output is in the form of a list of shaded Starbase polygons, which may be output directly to the screen or to an open display list segment.  Ray tracing output is a bitmap that may be output directly to a 24-plane display or dithered and output to an 8-plane display. 

The following procedures are provided in the Starbase Radiosity and Ray Tracing library. 

bf_surf_global_model( fildes, reflectance, transmittance, index_of_refr )
                      index_of_refr )
bf_surf_light_model( fildes, attr )
create_scene( fildes, root_seg, scene_id )
delete_scene( fildes, scene_id )
inq_bf_surf_global_model( fildes, reflectance, transmittance, index_of_refr ) }
                          index_of_refr )
inq_bf_surf_light_model( fildes, attr )
inq_cond_index_mode( fildes, scene_id, cond_ind_mode )
inq_rad_ambient_mode( fildes, scene_id, mode )
inq_rad_energy( fildes, scene_id, percent_remaining )
inq_rad_scale( fildes, scene_id, mode, gamma, ref_intensity )
inq_ray_aa_parms( fildes, scene_id, max_rays, max_variance )
inq_ray_dither_parms( fildes, scene_id, dither_scheme )
inq_ray_output( fildes, scene_id, screen_on )
inq_ray_tree_parms( fildes, scene_id, max_depth, tree_cutoff )
inq_scene( fildes, scene_id, root_seg, compute_type )
inq_shadow_switch( fildes, on )
inq_surf_global_model( fildes, reflectance, transmittance, index_of_refr )
                       index_of_refr )
inq_surf_illum_quality( fildes, quality )
inq_surf_light_model( fildes, attr )
inq_surf_shading_resolution( fildes, type, resolution )
output_scene( fildes, scene_id, output_type, devdes )
render_scene( fildes, scene_id, compute_type )
set_cond_index_mode( fildes, scene_id, cond_ind_mode )
set_rad_ambient_mode( fildes, scene_id, mode )
set_rad_scale( fildes, scene_id, mode, gamma, ref_intensity )
set_ray_aa_parms( fildes, scene_id, max_rays, max_variance )
set_ray_dither_parms( fildes, scene_id, dither_scheme )
set_ray_output( fildes, scene_id, screen_on )
set_ray_tree_parms( fildes, scene_id, max_depth, tree_cutoff )
shadow_switch( fildes, on )
spline_cone( fildes, l_rad, u_rad, height, x, y, z, dirx, diry, dirz, refx, refy, refz )
spline_sphere( fildes, rad, x, y, z, dirx, diry, dirz, refx, refy, refz )
spline_torus( fildes, min_rad, maj_rad, x, y, z, dirx, diry, dirz, refx, refy, refz )
              dirx, diry, dirz, refx, refy, refz )
surf_global_model( fildes, reflectance, transmittance, index_of_refr )
                   index_of_refr )
surf_illum_quality( fildes, quality )
surf_light_model( fildes, attr )
surf_shading_resolution( fildes, type, resolution )

FILES

The following files make up the Starbase Radiosity and Ray Tracing library.  Each is shown with a description of its function. 

/usr/lib/libsbrr.a Starbase Radiosity and Ray Tracing library

/usr/include/sbrr.c.h C program header file

/usr/include/sbrr.f1.h FORTRAN77 program header file

/usr/include/sbrr.f2.h FORTRAN77 program header file

/usr/include/sbrr.p1.h Pascal program header file

/usr/include/sbrr.p2.h Pascal program header file

The directory /usr/lib/sbrr/demos contains example programs presented in the Starbase Radiosity and Ray Tracing Programmer’s Manual, along with a makefile for compiling and linking them.

LOADING STARBASE RADIOSITY AND RAY TRACING PROGRAMS

The appropriate Starbase libraries and the Starbase Display List Subsystem libraries must be loaded along with the Starbase Radiosity and Ray Tracing libraries.  The order of specification of link files is extremely important.  The Starbase Radiosity and Ray Tracing library libsbrr.a must follow application modules, driver libraries, and libwindow.a in the link sequence, but precede the Starbase Display List Subsystem libraries libsbdl.a and libsbdlrefs.a and the Starbase device-independent libraries libsb1.a and libsb2.a. The relative order of the Starbase Display List Subsystem libraries and the Starbase device-independent libraries on the command line should follow the link instructions given in sbdl(3G).

For example, to compile and link the C program render.c for running on an hp98731, use:

cc render.c -ldd98731 -lsbrr -lsbdl -lsb1 -lsb2 -ldvio -o render -O

INCLUDE FILE USAGE

The following templates show how include files should be used with the various language bindings:

C Include Template:

#include <starbase.c.h>
#include <sbdl.c.h>
#include <sbrr.c.h>
 main()
{
    /* main program body */
}
 graphics_application_function()
{
    /* function body */
}

FORTRAN77 Include Template:

        INCLUDE ’/usr/include/starbase.f1.h’
        INCLUDE ’/usr/include/sbdl.f1.h’
        INCLUDE ’/usr/include/sbrr.f1.h’
         PROGRAM main
C
C       Application PARAMETER statements - constant definitions
C
        CHARACTER NULL
        PARAMETER( NULL = CHAR(0) )
         INCLUDE ’/usr/include/starbase.f2.h’
        INCLUDE ’/usr/include/sbdl.f2.h’
        INCLUDE ’/usr/include/sbrr.f2.h’
C
C       Rest of application main program.
C
        END
         SUBROUTINE graphics_application_subroutine
C
C       Application Subroutine PARAMETER statements- constant definitions
C
        CHARACTER NULL
        PARAMETER( NULL = CHAR(0) )
         INCLUDE ’/usr/include/starbase.f2.h’
        INCLUDE ’/usr/include/sbdl.f2.h’
        INCLUDE ’/usr/include/sbrr.f2.h’
C
C       Rest of application subroutine.
C
        END

Pascal Include Template:

PROGRAM main( INPUT, OUTPUT );
     $INCLUDE ’/usr/include/starbase.p1.h’$
    $INCLUDE ’/usr/include/sbdl.p1.h’$
    $INCLUDE ’/usr/include/sbrr.p1.h’$
     { CONSTANT definitions }
    { TYPE definitions }
    { VARIABLE declarations }
     $INCLUDE ’/usr/include/starbase.p2.h’$
    $INCLUDE ’/usr/include/sbdl.p2.h’$
    $INCLUDE ’/usr/include/sbrr.p2.h’$
     { PROCEDURE and FUNCTION definitions }
 BEGIN
    { main program body }
END.

SEE ALSO

starbase(3G), sbdl(3G), cc(1), pc(1), fc(1), ld(1),
Starbase Radiosity and Ray Tracing Programmer’s Manual,
Starbase Device Drivers Library Manual,
Starbase Display List Programmer’s Manual.
Starbase Graphics Techniques. Starbase Graphics Techniques.

  —  July 12, 1991

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026