(nothing)Note that nothing is an entirely valid scene object; it has no volume and never reflects any rays. It is used as the default state for things like groups.
|
|
(plane normal base)The plane object takes two parameters: a normal and a base. The base is simply any point that lies on the plane; the normal is a vector that points away from the plane. Note that "plane" is a misnomer; it's actually a halfspace. In this case, the plane has a normal of "positive Y" and is located at "<0 -1 0>".
|
|
(group ...)Groups combine multiple objects into one! For every point, the visible object is simply the one that's closest to the camera.
(color rgb object) (shine rgb object)The shine function changes the emitted color of an object. The color function changes the diffuse color of an object.
|
|
(pathtrace num-bounces scene)pathtrace computes indirect illumination. Whenever a ray hits an object, it casts a random sampling ray onwards, to estimate the light that the object receives. This randomness is the main cause of noisy images in path tracing.
(fuzz object)fuzz slightly jiggles the direction of the ray being traced. The result is anti-aliasing "for free".
|
|
(sphere center radius)This one should be self-explanatory.
|
|
|
|
(rand)Returns a random number between 0 and 1.
(cylinder from to radius)A capped cylinder between from and to with radius radius.
(for/group variable from to body)A for-loop, where every pass through the loop (for variable from from to to - 1) is expected to produce one object. The objects are combined into a group.
(box from to)An axis-aligned box with one corner at from and the other at to.
(camera position lookat scene)Normally, there is an implicit camera positioned at <0 0 0> and looking towards +Z, with "up" being +Y and "right" being +X. Using the camera function will transform the scene to position the camera at position and looking towards lookat.
|
|
Now we get into the realm of "Constructive Solid Geometry" (CSG).
This might get a bit complicated. We highly recommend that you go off and read that Wikipedia page if you are not yet familiar with CSG.
Fundamentally speaking, CSG is just the application of set theory to solid bodies. In other words, what we have considered a plane is in reality a half-space, a dividing surface above which is air and below which is solidity. Similarly, a sphere is just the set of all points within its radius.
It is important to understand that there is a difference between a sphere and an "anti-sphere" (a negated sphere) - a sphere is an object surrounded by a lot of nothing, an anti-sphere is a bubble of nothing, surrounded by a lot of stuff.
This will require an example. To illustrate, let's take the intersection between our sphere and a box.
(intersect objects...)The intersect object is an object formed by the intersection of its parameters. At each point on its surface, the innermost object is visible.
|
|
I see. So the combination of box and sphere means that the corners of our box have been filed off.
... Wait. I don't see.
It's straightforward. Fundamentally, an intersect object is comprised of only those parts of either object that are inside the other object.
The edge length of the box is a bit larger than the diameter of the sphere. So towards the sides of the box, where it was smaller than the sphere, only the box is visible, since it's inside of the sphere. However, since the sphere is round, it's smaller at the corners than the box, so at those spots it's inside of the box. So only the sphere is visible.
Now, how can we use this to cut out a hole in the ground?
Simple: we form the intersect between the floor and a negated cylinder.
With a normal cylinder, we'd get all the parts of the floor that are inside the cylinder; with a negated one, we'll get an object comprised of all the parts of the floor that are outside the cylinder.
Essentially, the cylinder will be missing from the floor.
Also, we lower our central sphere-box-thing into the hole we just created, neatly hiding it from view.
(negate object)The negate object is identical to its parameter object, except that the parameter object's inside becomes its outside and its inside becomes its outside. It essentially turns the object inside-out.
|
|