RayGay reference manual

Jesper Christensen

Title page

Figure 1. Our EPUB cover image icon

Chapter 1. Paths

Paths are a special category of objects in RayGay. A path can't be rendered, but it is useful for a few special purposes. A camera can be moved along a path or objects can be place along a path.

Chapter 2. Scene objects

There are several categories of renderable objects that can be added to a scene. Solid objects, collections of objects and meshes are examples.

Solids

Solid objects are objects that can be used for constructive solid geometry.

As solid objects can be constructed from other solid objects as boolean union, intersections and differences it is not necessary to specify the material on all these objects. Only the final object that is added to the scene must have a material assigned to it.

Sphere

(make-sphere center radius material)

(make-sphere center radius )

Makes a sphere. center is the center of the sphere as a 3D-vector. radius is a number specifying the radius of the sphere. The optional material sets the material of the object.

(make-sphere #(1 2 3) 10.5 chrome)

Creates a sphere centered in (1,2,3) with a 10.5 radius and uses the material chrome.

Ellipsoid

(make-ellipsoid center radii material)

(make-ellipsoid center radii )

Makes a ellipsoid which is like a sphere (See Sphere section) but with a different radius for each of the three axis'. Reversely is a sphere like an ellipsoid where the three radii are the same. center is a 3D-vector identifying the center of the ellipsoid. radii is 3D-vector specifying radius for each of the X,Y and Z axis' of the ellipsoid. The optional material sets the material of the object.

(make-ellipsoid #(1 2 3) #(3 4 5) monkeybutter)

Creates a ellipsoid centered in (1,2,3) with a radius of 3 along the x-axis, a radius of 4 along the the y-axis and a radius of 5 along the z-axis. It uses a strange material named monkeybutter.

(make-ellipsoid #(1 2 3) #(5 5 5) x-wing-black)

Creates a sphere centered in (1,2,3) with a radius of 5 and some material named x-wing-black.

Cylinder

(make-cylinder begin end radius material)

(make-cylinder begin end radius)

Makes a cylinder. begin and end are 3D-vectors describing the center of the base plate and top plate respectively. radius is a number specifying the radius of the cylinder. The optional material sets the material of the object.

Cone

Tip

A cone can simply be thought of as a cylinder with a different radius at each end.

(make-cone begin end radiusbegin radiusend material)

(make-cone begin end radiusbegin radiusend)

Makes a cone. begin and end are 3D-vectors describing the center of the base plate and top plate respectively. radiusbegin and radiusend are numbers specifying the radii of the base and top plates. The optional material sets the material of the object.

Torus

(make-torus big-radius small-radius material)

(make-torus big-radius small-radius)

Makes a torus placed in the origin (0,0,0). A torus can be thought of as a small circle extruded along a bigger circle. The two parameters big-radius and small-radius are the radii of these two circles. The big circles lies centered in the x,z-plane. The optional material sets the material of the object.

Solid box

(make-solid-box corner₁ corner₂ material)

(make-solid-box corner₁ corner₂)

Makes a solid box. The two 3D-vectors corner₁ and corner₂ must be diagonally placed corners of the box. The optional material sets the material of the object.

(make-solid-box #(-5 -5 -5) #(5 5 5))

Creates a cube centered in (0,0,0) with all sides having an area of 10×10.

Union

A union of A and B is the all the space A and all the space B looked upon as one, even if it is not connected.

(make-union solid₁ solid₂ ... solidn material)

(make-union solid₁ solid₂ ... solidn)

Makes a union of solidi which all are solid objects. The resulting object is the spatial set resulting from the boolean union solid₁ ∪ solid₂ ∪ ... ∪ solidn. The optional material sets the material of the object.

Intersection

An intersection of A and B is all the space A and B have in common.

(make-intersection solidL solidR material)

(make-intersection solidL solidR)

Makes an intersection of the two solid objects solidL and solidR. The resulting object is the spatial set resulting from the boolean intersecion solid₁ ∩ solid₂. The optional material sets the material of the object.

Difference

A difference A - B between two sets is whats left after all of B has been subtracted from A.

(make-difference solidL solidR material)

(make-difference solidL solidR)

Makes a difference of the two solid objects solidL and solidR. The resulting object is the spatial set resulting from the boolean difference or relative complement solid₁ - solid₂ which also can be written as solid₁ ⁄ solid₂. The optional material sets the material of the object.

Meshes

Meshes are scene objects constructed from triangles. We distinguish them from solids as they can not be used in constructive solid geometry.

Box

(make-box corner₁ corner₂ material)

Makes a box. Each side of the box is two triangles. These boxes render faster than solid boxes (See the section called “Solid box”) but can not be used in constructive solid geometry. The two 3D-vectors corner₁ and corner₂ must be diagonally placed corners of the box. The material sets the material of the object.

Heightfield

(make-heightfield heightmap size width-divisions depth-divisions material)

A heightfield is a mesh of triangles in a fixed grid or field in the x- and z-directions. The y-offsets are read from the supplied monochrome texture map. heightmap is a monochrome texture map. The 3D-vector size describes the width,height and depth of the heightmap. The two integers width-divisions and depth-divisions specify the numbers of subdivisions in the x and z directions. The material parameter sets the material of the object.

Extrusion

(make-extrusion path circle twists segments pieces material)

Pull the closed circle path along the path path to create a tube. The extruded tube is constructed of triangles. There are segments segments along path and pieces triangle segments around circle. The circle path should be a closed path lying in the x,y-plane. If the circle is asymmetrical around the origion (thus anything but a circle) the twists can be set to a non-zero integer value to let the circle-path be rotated twists times around the origin as it's extruded along path. The material parameter sets the material of the object.

Chapter 3. End notes

This space intentionally left blank.