Ray Trace Web Server
Go to the Spheres Ray Trace program.
Go to the description page that
explains about this pedagogic application and suggests some projects
to extend it.
Instructions:
The link above is a web-browser-based control for a Ray Tracing
application adapted from the one in Paul Graham's ANSI Common
Lisp. This application renders a scene in 3-space containing any
number of colored spheres. The input form shows the spheres in a
table, one sphere to a row.
Each sphere is characterized by seven numeric attributes:
- The center X ordinate, a real number in the range -10000..10000 with
zero at the center and X increasing to the right.
- The center Y ordinate, a real number in the range -10000..10000 with
zero at the center and Y increasing upwards.
- The center Z ordinate, a real number in the range 0..20000 with
zero at the viewpoint and Z increasing into the page.
- The Radius, a real number in the range 0..10000 .
- The RGB color coded as three separate integers in the range
0..255, larger numbers giving higher intensity.
You can edit the values of any attribute using any normal web
browser. Only those spheres with the Enable box checked will
be rendered. Non-enabled rows will be deleted the next time the
form is updated, so remember to check the box when you enter a new
sphere! The form always provides five empty rows at the end so new
spheres can be added.
Several buttons appear at the top:
- The Generate BMP Image renders the scene and returns the
form with the rendered image below. Not all browsers will display
bmp images inline; in particular, IE5 will but Netscape 5 will not
unless one of certain Plug Ins have been added.
- The Generate GIF Image similarly renders the scene and
returns a gif image instead. All browsers will display gif images,
but since gif generation depends on certain server-side Unix image
filter programs, this button will only be displayed if the server is
running on a Unix machine. (In fact the image generation has only
been checked on a few Linuxes and may not work without tweaking on
other Unix platforms.)
- The Update Form button updates the changes made on the
form and redisplays the form. The is useful primarily if all 5
empty table rows have been used and more are needed.
- The Reset Form button is the standard browser action to
undo all changes made to the form since it was displayed.
Finally, the Image Size radio buttons control the linear
dimensions of the generated square image. The total number of pixels
and therefore the rendering time increase with the square of the size,
so size 400 takes 16 times as long as size 100. Low magnifications
are useful for quick sketching and adjusting of the scene. Higher
magnifications should be reserved for final renderings.
Author: Steve Haflich (smh@franz.com)
Copyright 1999–2003 Franz Inc.