Povray documentation for
ray tracing assignment for CSC 473
Povray
objects are defined in ascii
text by the object name followed by braces, optional fields (that are usually
order independent) and closing braces. Objects in this document will be
listed with their default values.
Floats and Vectors
Values in Povray are specified as floating
point numbers and vectors. The syntax of a vector is:
< float1 , float2 , float3 >
Comments
Comments are
denoted by the // symbol and proceed until the end of the current line (similar
to C++ comments).
Camera
Cameras are
defined as the following:
camera
{
location
< 0 , 0 , 0 >
up < 0 , 1 , 0 >
right
< 1.333 , 0 , 0 >
look_at
< 0 , 0, -1 >
}
The location field specifies the location of
the camera. The up direction specifies the vector pointing
out of the top of the camera and the right vector specifies the vector
pointing out of the right of the camera. The look_at
field determines which way the camera is facing. While the up and right
fields define the orientation of the camera, they also determine the size of
the image plane. The image plane is located one unit from the camera
location. It has dimensions corresponding to the sizes of the right and
up vectors (centered around the origin). This determines where a specific
ray must for a given pixel. (Note that the camera vectors may need to be orthogonalized - do it in the order look_at,
up, right)
Point Light Sources
Point lights are the illumination for our scene. Light sources
have no visible shape, rather they provide light for
other objects in the scene. Point lights are defined as follows:
light_source
{ < X , Y , Z > color rgb < r , g , b > }
Where < X , Y , Z >
is the light source location and < r , g , b> is the light source
color. The light color also determines its intensity. For instance,
< 0.5 , 0.5 , 0.5 > is a light source half as
bright as < 1 , 1 , 1 >.
Objects
Objects are the building blocks of your
scene. They are what you will finally be seeing in your rendered
image. Objects are defined by an object name followed by some object
specific fields, followed by some optional modifiers.
objectname {
objectSpecficFields
[modifiers]
}
The objects that you will need in your program are
given below.
Box
The box is an axis aligned bow defined by two corners:
box { < CORNER1 > , < CORNER2 > }
Where < CORNER1 > and < CORNER2 > are
vectors defining the two corners of the box. Corner 1 must be less than
corner 2 (in all elements) in order for the box to appear. If one wants a
non axis aligned box, the axis aligned box can be
rotated translated and scaled like all objects.
Sphere
The sphere is
defined by a center point and radius:
sphere
{ < CENTER > , RADIUS }
Cone
Cones are defined by two endpoints and two radii:
cone { < END1 > , RADIUS1 , < END2 > , RADIUS2 }
Where END1 and END2 define the centers of each end
of the cone and RADIUS1 and RADIUS2 are the radii of the cone at those
endpoints. Therefore the cone does not have to come to a sharp point at
the top and can also designate a cylinder.
Plane
Planes are
infinite primitives defined by a normal and distance:
plane
{ < NORMAL > , DISTANCE }
If the NORMAL is defined as < A
, B , C > and the DISTANCE as D, then the plane satisfies the
equation:
A * x + B * y + C * z = D
Triangle
Triangles are
similar to planes except they don't extend infinitely in all directions.
They are usually used to make more complex objects and are defined by 3
vertices:
triangle
{ < CORNER1 > , < CORNER2 > , < CORNER3 > }
Modifiers
Modifiers are fields within objects that alter the
current state of the object. Examples of modifiers are transformations,
pigments (colors) and finish (surface properties).
Transformations
The transformations on an object are applied in top
down order (the first transformation in the object is the first one applied to
the object, followed by the second, etc.). The three transformations are:
translation, rotation and scaling.
Translation
Translations are
defined as relative movements of an object and are specified by a vector:
translate
< TX , TY , TZ >
Rotation
Rotations are
specified in Euler angles around the coordinate axes. The order of
rotation is x axis, then y axis, then z axis.
rotate
< RX , RY , RZ >
Scaling
Scalings are defined by either a float
(uniform scaling) or a vector (nonuniform
scaling):
scale
s
scale
< SX , SY , SZ >
Pigment
Pigment defines the objects color (used in shading
calculations). They are defined as rgb triples
or rgbf quads where f is the filter component
specifying how transparent the object is. The values for the components
should lie between 0 and 1. Filter defaults to 0 if unspecified.
pigment { color rgb < R , G , B
> }
pigment { color rgbf < R , G ,
B , F > }
Finish
Finish specifies the surface properties of an
object such as reflectance and refractance. It
contains optional fields with default values:
finish {
ambient 0.1
diffuse
0.6
specular
0.0
roughness 0.05
reflection 0.0
refraction 0.0
ior
1.0
}
Ambient
Ambient specifies
the amount of ambient light the object receives. This is light scattered
from many different sources and is extremely hard to calculate in practice.
Diffuse
Diffuse specifies
the amount of diffuse light reflected from an object (light reflected in all
directions equally).
Specular
Specular specifies the amount of specular reflection (creates highlights).
Roughness
Roughness
specifies the size of the specular highlight.
Reflection
Reflection
specifies the reflection coefficient of the surface (percentage of light
reflected)
Refraction
Refraction turns
on refraction for an object (otherwise pure transmission is used).
Ior Ior specifies the index of refraction of the object.