Animation Tutorial 1 POVRAY Files
Previous Next
diggerscene.pov
#include "digger.inc"
digger(default_options)
#include "ldrawcam.inc"
TrackingCamera(<0,-90,-170>,350,45,13)
BlueBackground()
GreenFloor(0)
Light(<0,-280,-220>)
Light(<200,-220,80>)
Light(<-100,-300,30>)
|
|
Ldrawcam.inc
#declare AMB = 0.4;
#declare DIF = 0.4;
#declare QUAL = 2;
#declare STUDS = 1;
#declare BUMPS = 0;
#declare BUMPNORMAL = normal { bumps 0.01 scale 20 }
// ------------------------------------------------------------
// Persistence of Vision Ray Tracer include file
// File: camera.inc
// Vers: 3.1
//
// Desc: This include file defines macros that make using
// a camera easier. Three cameras a defined here.
// A standard camera where you define the view point
// and the look at point. A panning camera where the
// location of the camera is stationary but the view is
// a fixed distance from the view point. And a Tracking
// camera where you define the view point and the camera
// location is relative to it.
//
// Last Update Date: 01/28/1999
//
// Auth: Jim Figiel
//
// ------------------------------------------------------------
//
// Variable definitions
//
// CameraMode - Mode the camera is in
// 0 = Standard
// 1 = Panning - stationary location, fixed distance
// 2 = Traking - moving location, fixed distance, fixed direction
// from CameraViewPoint
// 3 = Directional - stationary location,rotation and angle ar specified
// 4 = Panoramic - stationary location, angle = 0 points in the negative
// z direction, angle = 1 points in the posative z direction
// CameraDistance - Distance for camera to be from the At point when camera is in
// tracking mode
// CameraRotate - Direction around the Y axis for directional tracking
// CameraAngle - Horizon angle for directional tracking
// CameraLocation - Vector of the camera location for Standard and panning mode, this
// is calculated for tracking mode
// CameraViewPoint - Vector of the point the camera is aimed at
#ifndef (camera_inc)
#declare camera_inc = true;
#macro StandardCamera( ViewPoint , Location )
MultiCamera( 0 , 0 , 0 , 0 , Location , ViewPoint,1,1 )
#end
#macro TrackingCamera( ViewPoint , Distance , Rotate , Angle )
MultiCamera( 2 , Distance , Rotate , Angle , <0,0,0> , ViewPoint,1,1 )
#end
#macro PanningCamera( ViewPoint , Location , Distance )
MultiCamera( 1 , Distance , 0 , 0 , Location , ViewPoint,1,1 )
#end
#macro DirectionalCamera( Location , Rotate , Angle )
MultiCamera( 3 , 0 , Rotate , Angle , Location , <0,0,0> , 1 , 1 )
#end
#macro PanoramicCamera( Location , Angle )
MultiCamera( 4 , Angle , 0 ,0 , Location , <0,0,0> , 1 , 1 )
#end
#macro MultiCamera( CameraMode ,
CameraDistance ,
CameraRotate ,
CameraAngle ,
CameraLocation ,
CameraViewPoint,
x_value,
y_value )
// global_settings
// {
// assumed_gamma 2.2
// }
#local CameraXCalc = 0;
#local CameraYCalc = 0;
#local CameraZCalc = 0;
#local CameraAngle = -CameraAngle;
#local CameraRotate = -CameraRotate;
#if (CameraMode=1) //Panning Camera
#local LocAtDistance = vlength(<CameraLocation.x,CameraLocation.y,CameraLocation.z>-<CameraViewPoint.x,CameraViewPoint.y,CameraViewPoint.z>);
#local CameraXCalc = CameraViewPoint.x+(((CameraLocation.x-CameraViewPoint.x)*CameraDistance)/LocAtDistance);
#local CameraYCalc = CameraViewPoint.y+(((CameraLocation.y-CameraViewPoint.y)*CameraDistance)/LocAtDistance);
#local CameraZCalc = CameraViewPoint.z+(((CameraLocation.z-CameraViewPoint.z)*CameraDistance)/LocAtDistance);
#else
#if (CameraMode=2) //Tracking Camera
#local CameraTempVector = vrotate(<0,0,-10>,<CameraAngle,CameraRotate,0>);
#local CameraTempVector = CameraTempVector + <CameraViewPoint.x,CameraViewPoint.y,CameraViewPoint.z>;
#local CameraLocation = CameraTempVector;
#local LocAtDistance = vlength(<CameraLocation.x,CameraLocation.y,CameraLocation.z>-<CameraViewPoint.x,CameraViewPoint.y,CameraViewPoint.z>);
#local CameraXCalc = CameraViewPoint.x+(((CameraLocation.x-CameraViewPoint.x)*CameraDistance)/LocAtDistance);
#local CameraYCalc = CameraViewPoint.y+(((CameraLocation.y-CameraViewPoint.y)*CameraDistance)/LocAtDistance);
#local CameraZCalc = CameraViewPoint.z+(((CameraLocation.z-CameraViewPoint.z)*CameraDistance)/LocAtDistance);
#else
#if (CameraMode=3) //Directional Camera
#local CameraTempVector = vrotate(<0,0,10>,<CameraAngle,CameraRotate,0>);
#local CameraXCalc = CameraLocation.x;
#local CameraYCalc = CameraLocation.y;
#local CameraZCalc = CameraLocation.z;
#local CameraViewPoint = CameraTempVector+CameraLocation;
#else
// #if ( CameraMode=0 ) //Standard Camera
#local CameraXCalc = CameraLocation.x;
#local CameraYCalc = CameraLocation.y;
#local CameraZCalc = CameraLocation.z;
// #end
#end
#end
#end
#local CameraLocation = <CameraXCalc,CameraYCalc,CameraZCalc>;
#debug concat("\nCamera Location <",str(CameraLocation.x,9,2),",",str(CameraLocation.y,9,2),",",str(CameraLocation.z,9,2),">\n\n")
#if( CameraMode=4)
camera
{
panoramic
location CameraLocation
direction 1.5*z
sky -y
up y*y_value
up y
right -4/3*x*x_value
#if(CameraDistance=1)
look_at CameraLocation+<0,0,1>
#else
look_at CameraLocation+<0,0,-1>
#end
}
#else
camera
{
location CameraLocation
direction 1.5*z
sky -y
up y*y_value
up y
right -4/3*x*x_value
look_at CameraViewPoint
}
#end
#end // macro MultiCamera()
#macro CameraAxis( loc , s , lt )
object
{
union
{
cylinder { <0,0,0> , x*s , lt texture { pigment { color <0,0,1> } finish { ambient 1 diffuse 0 } } }
cylinder { <0,0,0> , y*s , lt texture { pigment { color <0,1,0> } finish { ambient 1 diffuse 0 } } }
cylinder { <0,0,0> , z*s , lt texture { pigment { color <1,0,0> } finish { ambient 1 diffuse 0 } } }
}
translate loc
}
#end
#end
#macro BlueBackground()
Background(<0.3,0.8,1>)
#end
#macro WhiteBackground()
Background(<1,1,1>)
#end
#macro BlackBackground()
Background(<0,0,0>)
#end
#macro GreyBackground()
Background(<0.5,0.5,0.5>)
#end
#macro GreenFloor(h)
#ifndef (Color2)
#declare Color2 = #if (version >= 3.1) material { #end texture {
pigment { rgb <0.117647,0.627451,0.227451> }
finish { ambient AMB diffuse DIF }
#if (QUAL > 1)
finish { phong 0.5 phong_size 40 reflection 0.08 }
#if (BUMPS) normal { BUMPNORMAL } #end
#end
} #if (version >= 3.1) } #end
#end
Floor(h,<0.5,1,0.5>)
#end
#macro Floor(h,c)
object { plane { y , h material {Color2} } }
#end
#macro Background(c)
background { color rgb c}
#end
#macro Light(p)
light_source {
p
color rgb <1,1,1>
}
#end
#macro Move( o , trans , rot )
object { o rotate rot translate trans}
#end
#macro LMove( o , trans , rot )
object { o rotate rot translate <trans.x*20,trans.y*8,trans.z*20> }
#end
|
|
Previous Next
|