Benjammin's Povray Pages HOME Benjammin's Povray Pages

CLOCK and CAMERA - Part 4

Example 10

This example shows how to use the clock to shift focus.

camera { location 0 rotate y*50 
		translate <-6, 1, -4>
	 	aperture 0.9 
		blur_samples 20 
		focal_point <-5+(clock*15), 0, 0>  
	}

light_source { 0*x color rgb 1 
		translate <-30, 30, -30>
	}

plane { y, -1 pigment {checker color rgb 1 
			color rgb <0.5,0.5,0.5> 
			scale 1.0}
	}

sphere { -4.0*x, 1 pigment {color rgb <1,0,0>} }
sphere { 0.0, 1 pigment {color rgb <0,1,0>} }
sphere { 8.0*x, 1 pigment {color rgb <0,0,1>} }

an2_10.gif

The first line in the camera statement just sets us up and doesn't need explanation. The next line with the aperture 0.9 blur_samples 20 focal_point <-5+(clock*15), 0, 0> directives are the one that concern us, particularly the focal_point one. After setting up the aperture (depth of in focus point) and blur samples (do I need to explain?) we animate the x axis vector of the focal_point directive. First pulling it back to where we want to start, roughly in front of the red ball but with a big enough aperture to keep it all in focus. Then the clock drives the focus 15 units so we end up in the same situation with the blue sphere. And yes I know the GIF looks a little odd, that's a result of using only 16 colors to keep the size down, hence the unsmooth motion and look. When you render this in glorious 24 bit color you'll see how nice this effect can look.

Example 11

This example shows much the same thing as the prior example but now we're adding a little motion.

camera { location <-6, 1, -4> 
		look_at <-4+(clock*12), 0, 0> 
	 	angle 60-(clock*40) 
		aperture 0.9 
		blur_samples 20
	 	focal_point <-5+(clock*15), 0, 0>
	}

light_source { 0*x color rgb 1 
		translate <-30, 30, -30>
	}

plane { y, -1 pigment {checker color rgb 1 
		color rgb <0.5,0.5,0.5> 
		scale 1.0}
	}

sphere { -4.0*x, 1 pigment {color rgb <1,0,0>} }
sphere { 0.0, 1 pigment {color rgb <0,1,0>} }
sphere { 8.0*x, 1 pigment {color rgb <0,0,1>} }

an2_11.gif

Here the clock driven focal_point is the same as before. We're just using some things you've already learned to alter our viewpoint and zoom in. In the real world of film this is a pretty complex move because you're adding camera motion, changing lens length and keeping focus all in one go.

Example 12

In these last two examples we'll affect the shape of the lens. In the first one I'm using a normal definition to warp the view. Now you might say, "wait a minute, part of a texture definition for a lens?". Well its perfectly legal POV script and in fact is part of the stock Camera Definition insert. It might not look pretty if you're rendering single images but it works as a great filter for animation.

camera { location z*-8  normal { ripples 0.1 
					rotate y*360*clock} 
	}

light_source { 0*x color rgb 1 
		translate <-30, 30, -30> 
	}

plane { y, -1 pigment {checker color rgb 1 
			color rgb <0.5,0.5,0.5> 
			scale 1.0} 
	}

sphere { -4.0*x, 1 pigment {color rgb <1,0,0>} }
sphere { 0.0, 1 pigment {color rgb <0,1,0>} }
sphere { 4.0*x, 1 pigment {color rgb <0,0,1>} }

an2_12.gif

We've applied normal { ripples 0.1 rotate y*360*clock) to the camera and given it a texture characteristic. So basically the shape of the lens hss been affected. By selecting an axis, in this case y, and having it do a full rotation of 360 degrees we can do a looped wave/ripple effect. Want to speed up or slow down effect? Just apply more or less rotation. Experiment using other pattern modifiers to see what effects you can get.

Example 13

And in the final example we're changing the aspect ratio of the lens. That is to say the normal aspect ratio for povray is right x*4/3 which in video speak turns into 4:3. You get 4 pixels rendered across the x axis for every 3 down the y axis. Change that ratio and you can compress or expand an image along the x axis while still maintaining original frame size.

camera { location z*-8  
	right 4/(3-clock*2)*x 
	}

light_source { 0*x color rgb 1 
		translate <-30, 30, -30> 
	}

plane { y, -1 pigment {checker color rgb 1 
			color rgb <0.5,0.5,0.5> 
			scale 1.0}
	}

sphere { -4.0*x, 1 pigment {color rgb <1,0,0>} }
sphere { 0.0, 1 pigment {color rgb <0,1,0>} }
sphere { 4.0*x, 1 pigment {color rgb <0,0,1>} }

an2_13.gif

So we've used our clock to change our viewing ratio from 4/3 to 4/1, or in otherwords squeeze things in our image to 1/3 their original width. Not sure how I'm arriving at the 1/3 figure? Well the start number at the bottom is 3 and we ended with 1. So 1 or 3 is 1/3. If you wanted to squeeze things to 1/4 original you'd work the clock to end up at 0.75. Which gives you 0.75/3 = 1/4.

Another way to look at it is to do the equation this way ...

 1/(end_ratio/start_ratio)

... which gives you ...

 1/((4/1)/(4/3)) = 1/(4/1.333) = 1/3

... and that gives you the amount of x squeezing you've done.

And here's a zip of the POV and INI files for this tutorial: pov_an2d.zip

Okay, any more and I'd be flogging a dead horse. By now you can see that there's many different ways to work with the clock and camera. Just about anything that has a vector/value can be animated ... and that's the subject of the next tutorial ANIMATING VECTORS.

Happy Animating! - Benjammin

PREV - Part 3      HOME

Copyright Ben Teschendorff 2004

 00094 

Povray Links
Povray Now! www.povray.org
Moray Now! www.stmuc.com/moray
My Links
Benjammin's MainVision Pages - scripts and info
Benjammin's Music Pages
The Gasworks - Always a Babe Fest
Atomic Linux - automate your home
Benjammin's Software Pages
Video Links
Main Concept - excellent video software
Virtual Dub - excellent free video software
EyeDropVideo - royalty free animations, images, audio
More Links
Very cool sculptures, statues and jewelery