Modeling Theater Sets with POV-Ray (Part 2)

In part one we saw how to setup a basic scene with POV-Ray and render it to an image. We also declared a bunch of standard size scenery flats for use in modeling our set. Oh, and I warned there would be math.

To model our set in POV-Ray, we’ll do basically the same thing we do when building the set on-stage… we’ll take our standard flats, move and spin them around, then fix them in place. In POV-Ray we use two commands in the scene description language to do this: rotate and translate. (The fixing in place is automatic in POV-Ray–gravity doesn’t exist in our virtual world unless we program it!)

Let’s add some flats to the basic scene in part one.  To make adding a color simple, I’m going to wrap all the flats in a union so I can add color to the union once, rather than to each flat object.

union {
object { Flat_4x10 }
object { Flat_4x10_Door translate < -4, 0, 0 > /* translate just this flat */ }
pigment { color rgb 1 } // colors the whole union

When I add a flat, it’s going to be in the same location as the first flat I added. I need to move it into the position I want it. In this case I want it stage right of the first flat. Because the flat is 4 feet (1 foot = 1 unit) long, I need to translate the object -4 along the x-axis. As a reference, I’ve put a red dot at the origin of the coordinate system and green and blue lines for the x- and y- axes, respectively.

Set model with 2nd flat
Set model with 2nd flat

If I want to add another flat on the stage left side of the first flat, I would have to translate +4 along the x-axis.

object { Flat_4x10_Door translate <4, 0, 0> }

Set model with 3rd Flat
Set model with 3rd Flat

But the design calls for that flat to be angled 45 degrees toward center stage.  This is a rotation around the y-axis in POV-Ray.  It’s important to rotate before translating.

object { Flat_4x10_Door rotate <0,45,0> translate < 4, 0, 0> }

Set model with rotated 3rd Flat
Set model with rotated 4th Flat

The design has a similar flat on the stage right side that is also angle 45 degrees toward center.  We put our thinking hats on and try the obvious thing.

object { Flat_4x10 rotate <0,-45,0> translate <-8,0,0> }

Set model with mistake rotating 4th flat
Set model with mistake rotating 4th flat

But it’s a mistake and the flats don’t line up.  Things worked on the other side because the rotation moved the “far” side of the flat and not the side that we lined up with the translation.  This time, we’re trying to “attach” the side of the flat that moved during rotation.  We need to bust out our trigonometry to calculate what the coordinates should be.  SOHCAHTOA, BABY!

Here’s a top-down view of our model so far, with some labels for distances we need to figure out.

Top-down model view with distance labels
Top-down model view with distance labels

We tried translating the flat to <-8, 0, 0>.  We need the flat at <-8, 0, 0> + <(d)istance, 0, (o)pposite>. We know h = 4, because that’s the length of our flat. We know the angle is 45 degrees. Trigonometry tells us,


So, the correct offset is <-8, 0, 0> + <4 - 4*cos(-45), 0, 4*sin(-45) >.  POV-Ray’s language includes the trig functions, but the work in radians, not degrees.  We’ll have to include a conversion.

object { Flat_4x10 rotate <0,-45,0> translate <-8,0,0> + <4-4*cos(-45*0.0175), 0, 4*sin(-45*0.0175)> }

This slideshow requires JavaScript.

Whew!  Now you know about all there is to know about moving flats around in POV-Ray.  Truthfully, I usually eyeball flat positioning in the top-down view.  In part 3, I’ll go over the top-down camera and other techniques for getting drawing-style images.

One thought on “Modeling Theater Sets with POV-Ray (Part 2)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s