The keywords used to control the camera position are:
eyep x y z lookp x y z up x y zThe "eyep" (eye point) is the camera location, the "lookp" (look point) is the camera's point of focus, "up" defines which way is up! In each case "x y z" refers to some point. In the example below the camera is placed at (7.5 7.5 4) and looks at (0 0 1); the "up" keyword defines a vector: the (notional) line from the origin (0 0 0) to (0 0 1) - which in this case is vertical - is the "up" direction.
The listing below shows 5 "salmon" coloured boxes in a row, the base is "aqua"
coloured. Note that the surface names, are simply names: the salmon colour is
a redy-pink, but it would have been blue if the surface colour defined a blue!
Rayshade continues the camera analogy by allowing the camera's aperture
and focal-distance to the defined. These keywords can be used, for
example, to create an image which is out of focus or in which the
background is out of focus.
Combining out of focus scenes with smallish images (so that pixels are visible
when the image is printed) can lead to some interesting effects.
If your images will be printed, then you may want to use the proportion of
the paper, for example 1:1.414 for standard A4 or 1.414:1 for A3 sized paper.
Basically, be aware from the start, of how your final images will be
presented and use that understanding to guide you in the proportion of your
images.
Note that the images in this document are generally 3x2 in proportion despite being
designed to be printed on A4 paper: because the images only take up a small part of
each page it doesnot really matter what their proportion is!
Most of the examples in this document specify a white background (background .9 .9 .9)
because my final output is (white) paper.
Return to Contents.
THE END - Notes on Rayshade - 1 - Introduction
Figure 1-1
/*
group.ray
simple scene
Stephen Peter fri 28 feb 92
*/
eyep 7.5 7.5 4 /* place camera here */
lookp 0 0 1 /* camera focuses here */
up 0 0 1 /* this is the default */
background .9 .9 .9 /* image background colour */
screen 300 200 /* image size (in pixels) */
light 1 point -10 20 5 /* light source */
surface aqua
ambient 0 .2 .2 diffuse .2 .8 .8
specular .3 .3 .3 reflect .5
/* base */
box aqua -5 -5 -0.5 5 5 0
surface salmon
ambient .2 .1 .09
diffuse 1 .5 .44
specular .3 .3 .3
box salmon 3 0 0 4 1 2
box salmon 1 0 0 2 1 2
box salmon -1 0 0 0 1 2
box salmon -3 0 0 -2 1 2
box salmon -5 0 0 -4 1 2
The "camera" used by Rayshade has a variable field of view (like a zoom lens).
Both the horizontal and vertical fields of view may be specified,
allowing the image of the scene to create "fish-eye" (and other) effects. The
default field of view is 45 degrees. Note that it is possible to "squash" an
image using the field of view. fov hfov [ vfov ]
Generally, specify the horizontal field of view and let Rayshade work out
the vertical from the proportion of the image being output. aperture radius
focaldist dist
The default aperture is 0, the larger the aperture radius, the "tighter" the
focus. When aperture is 0 everything is in focus, but with aperture set to 1
(as in the example below) even objects relatively close to the focus point are
out of focus.Figure 1-2
/*
group3.ray
simple scene - shows blurring due to aperture
Stephen Peter fri 28 feb 92
*/
eyep 7.5 7.5 4 /* place camera here */
lookp 0 0 1 /* camera focuses here */
up 0 0 1 /* this is the default */
background .9 .9 .9 /* image background colour */
screen 300 200 /* image size */
light 1 point -10 20 5 /* light source */
aperture 1 /* use camera aperture 1 */
surface aqua
ambient 0 .2 .2 diffuse .2 .8 .8
specular .3 .3 .3 reflect .5
/* base */
box aqua -5 -5 -0.5 5 5 0
surface salmon
ambient .2 .1 .09
diffuse 1 .5 .44
specular .3 .3 .3
box salmon 3 0 0 4 1 2
box salmon 1 0 0 2 1 2
box salmon -1 0 0 0 1 2
box salmon -3 0 0 -2 1 2
box salmon -5 0 0 -4 1 2
The default focal distance is the distance from the eye point to the look point, in the
example that is square-root(7.5x7.5 + 7.5x7.5 + 3x3) = 11.0227, you remember pythagoras' theorum don't
you?Figure 1-3
/*
group4.ray
simple scene - shows blurring due to focal distance
Stephen Peter fri 28 feb 92
*/
eyep 7.5 7.5 4 /* place camera here */
lookp 0 0 1 /* camera focuses here */
up 0 0 1 /* this is the default */
background .9 .9 .9 /* image background colour */
screen 300 200 /* image size */
light 1 point -10 20 5 /* light source */
aperture 1 /* use camera aperture 1 */
focaldist 9 /* it was 11 (eyep->lookp) */
surface aqua
ambient 0 .2 .2 diffuse .2 .8 .8
specular .3 .3 .3 reflect .5
/* base */
box aqua -5 -5 -0.5 5 5 0
surface salmon
ambient .2 .1 .09
diffuse 1 .5 .44
specular .3 .3 .3
box salmon 3 0 0 4 1 2
box salmon 1 0 0 2 1 2
box salmon -1 0 0 0 1 2
box salmon -3 0 0 -2 1 2
box salmon -5 0 0 -4 1 2
Rayshade can produce images of varying sizes from the same input file.
Generally, when "testing" a scene you want to see the result quickly: to do
this specify a small image size; the screen keyword is used to control the
image size (in pixels): screen xsize ysize
The proportion of the image is also important. If you know that the final
output will, for example, be 35mm slides, you should probably use the
proportion of those slides (3x2), from the start. The initial images therefore
may be 300x200 or 450x300, then when you are ready to do the final
image(s) use a screen size of (for example) 600x400 or 900x600.
When doing simple scenes the other keyword commonly used when defining
a view of a scene is the background colour used in the images produced. background r g b
Rayshade, by default, will use a black background (background 0 0 0). This
is appropriate in most cases, but, as I stated above, be aware of your final
output media.
Go to next section: Positioning the Eye and Look Points.