![]() |
EGR
199: Fundamentals of Engineering |
3D Modeling and Ray Tracing |
| Prabhaker Mateti | ||
|
Table of ContentsExecutive SummaryBackground Information
Procedures
|
|
Executive Summary |
This article introduces 3D modeling, and ray tracing. It assumes that the student is already familiar with Web, HTML authoring. and VRML.
Suppose you have the following problem. You have a real-world scene whose still pictures you are shooting. You want to see it from different angles, with different light sources, and placed at different positions. You could do what the old-world movie makers did. Spend a lot of money and energy, hire a lot of people, construct elaborate sets, and take pictures. Or ...
camera {
location <0, 80, -200>
right <4/3, 0, 0>
up <0, 1, 0>
sky <0, 1, 0>
direction <0, 0, 1.8>
look_at <0, 15, 0>
}
|
You can describe the shapes of a real-world scene with 3D geometry. Apply textures. Position the light sources. You may do this using an interactive modeling system, like a CAD package, or by creating a text file that has a programming language-like syntax to describe the elements. In the 3D format knowns as .POV, a particular camera is described at left. |
- =![]() |
The Constructive Solid Geometry consists in building objects by using solid primitives and Boolean operators. Each primitive represent a real volume. It means that a CSG modeler can determine whether a point is outside or inside a solid object and combine them to create complex shapes. This modeling technique is very powerful and generate accurate representations than can be used in engineering or manufacturing.
In surface modeling, object geometry is not
completely expressed like in CSG. Surface modeling is only concerned in
building the outside shell of an object. |
![]() |
We use points placed in a 3D space to form curves and combine several curves to generate surfaces (with no thickness). | ![]() |
In the physical world, rays of light are emitted from a light source and illuminate objects. The light reflects off of the objects or passes through transparent objects. This reflected light hits our eyes or perhaps a camera lens. A light source emits rays in all directions. Only a very small percentage of these rays hit an observer. If a computer program were to literally do this, it would take forever to trace a scene.
Ray casting traces a ray from the eye through a point on the object being viewed, and find intersections with all the obejects in the scene. The intersection that has the smallest z value determines the color of the pixel (picture element) on the screen. Ray tracing goes further by reflecting the ray off the object and tracing it further, which may get reflected, and so on until it exits the scene or reaches the light source. If the surface were tranparent, and additional refracted ray is traced. Ray tracing is a rendering technique that calculates an image of a 3D real world scene by simulating the way rays of light travel.
Ray tracing algorithms start with their simulated camera and trace rays
backwards out into the scene. The user specifies the location of the camera,
light sources, and objects as well as the surface texture properties of objects,
their interiors (if transparent) and any atmospheric media such as fog, haze, or
fire. For every pixel in the final image one or more viewing rays are shot
from the camera, into the scene to see if it intersects with any of the objects
in the scene. These viewing rays originate from the viewer (the camera),
and pass through the viewing window (containing the final image).
Every time an object is hit by a ray, the color of the surface at that point is
calculated. For this purpose rays are sent backwards to each light source to
determine the amount of light coming from the source. Shadow rays determine
if a surface point lies in shadow or not. If the surface is reflective or
transparent, new rays are set up and traced in order to determine the
contribution of the reflected and refracted light to the final surface color.
![]() |
||||
|
Here is a Poser head with the sun as the light source. |
The same head with one white spot light. |
This head has a spot and a radial light to lighten up the shadows. |
Now the head has colored lights. The main spot is a warm color and the radial light is a cool color. |
|
Radiosity is an extra calculation that computes the diffuse interreflection
of light more realistically. This diffuse interreflection can be seen if
you place a white chair in a room full of blue carpet, blue walls and blue
curtains. The chair will pick up a blue tint from light reflecting off of other
parts of the room. Also notice that the shadowed areas of your surroundings are
not totally dark even if no light source shines directly on the surface. Diffuse
light reflecting off of other objects fills in the shadows. Typically
ray-tracing uses a trick called ambient light to simulate such effects but it is
not very accurate. Radiosity is more accurate than simplistic ambient
light but it takes much longer to compute. For this reason, POV-Ray does not use
radiosity by default. Radiosity is turned on using the Radiosity INI file option
or the +QR command line switch.
POV is a 3-dimensional ray tracing engine. It takes your 3D model and simulates the way light interacts with the objects you have defined. It can create stunning 3D pictures and animation. In addition to ray tracing, POV uses radiosity to add greater realism to scenes containing diffuse light sources such as the fluorescent lighting. POV can simulate many atmospheric and volumetric effects (such as smoke and haze).
The coordinate system for POV-Ray has the positive Y axis pointing up, the positive X axis pointing to the right, and the positive Z axis pointing into the screen. The X, Y, Z coordinates of a location is specified with a 3-part vector of 3 numeric values, between angle brackets and separating the values with commas.
In a previous lab, you have seen examples of VRML scenes. The syntax of the .wrl VRML files is different from .pov files.
POV is a rendering engine only, it does not include a modeler. A modeler is a program which uses graphics to make the job of creating 3D objects simpler. Using a modeler you can arrange structures by visually interacting.
sPatch is freeware. It is a
Bezier patch based modeler that exports POV, DXF and VRML on Windows 95/NT. It
can build models for VRML browsers and POV-Ray. Because it is spline
based it especially good for bio shapes and curvy objects.
The machines in 141 RC have POV version 3.0x, and sPatch installed.
1.1 Have a look at the details of this rendering: Alien.jpg. Note that this is a 174KB file.
1.2
Create a new file from within POV. File/New. Copy and Paste pieces of the following the text file -- an example of a POV model --, one piece at a time. After each paste, Render it to see the effect you produced. When all of the contents are in, it will render as a blue ball sitting on a patterned gray reflective table top.
Note that lower case Upper Case distinction is made in .pov files.
|
#include "colors.inc"
camera {
location <0,0.5,-7>
look_at <0,0,0>
}
light_source {<100,140,-300> color White}
plane {
<0,1,0>,-1
texture {
pigment {color Silver}
normal {bumps 0.5 scale .8}
finish {
phong 1 reflection .5
ambient 0.4 diffuse 0.
} } }
sphere { <0,0,0>,1
texture {
pigment { color Blue }
finish {
reflection 0.2 diffuse 0.1
ambient 0.8 phong .8
} } }
|
|
Shape the Bottle
|
|
![]() |
|
Refine the Shape
|
|
![]() |
|
Turn the Lathe ON
|
![]() ![]() |
|
![]() |
|
Create the relief on the bottle surface.
|
![]() |
|
![]() |
|
Melt the Bottle!
|
|
![]() |
|
A few acronyms and their expansions are collected in the
table here. If you are curious about an acronym or term not listed, type
it in the input box below, and then press the button to look it up in the TechEncyclopedia. |
| pmateti@cs.wright.edu |