|
![](/i/fill.gif) |
> Q: Has anyone seen a more descriptive diagram of the camera?
This is how I look at it... the up, right, and direction vectors all
really share the same origin, but they are used to describe the
viewing plane that the direction vector points at the middle of.
Then you can view the other camera keywords as modifiers,
they modify the up, right, and direction vectors in some way.
Location translates the vectors.
Look_at rotates the vectors to point somewhere.
The sky vector changes how the rotation happens.
Angle changes the length of the direction vector to
fit a given horizontal viewing angle.
It's a trigonometry problem to figure out the exact pixel of
some location in the scene with a given camera. You
know the vector from the camera to the object, and
you know the location of the viewing plane, so you just
figure out the angles between the direction vector and
that.
// camera diagram
#include "colors.inc"
camera {
location <2.5, 1, -2.5>
direction z
up y
right x*image_width/image_height
look_at <0, 0.25, 1>
angle 32
}
background {White}
light_source {
<0, 0, 0>
color rgb <1, 1, 1>
translate <30, 30, -30>
}
#macro Arrow(A B P)
union {
#local _vc = vnormalize( B-A )*0.5;
#if (0.5 > vlength(B-A)/2)
#local _vc = vnormalize( B-A )*vlength(B-A)*0.5;
#end
cylinder { A, B-_vc, 0.02}
cone { B - _vc, 0.04, B, 0}
pigment{P}
}
#end
// viewing plane
polygon {4,
<-0.5*1.33,0.5,1>,<0.5*1.33,0.5,1>,
<0.5*1.33,-0.5,1>,<-0.5*1.33,-0.5,1>
pigment{Blue transmit 0.9}
}
// the direction vector
Arrow(<0,0,0>,<0,0,1>,Yellow)
text {ttf "timrom.ttf", "Direction", 0.01,0
scale <0.08,0.1,1>
translate <0.1,0.04,0>
rotate <0,-90,0>
pigment {Yellow}
}
// the right vector
Arrow(<0,0,0>,<1.33,0,0>,Red)
Arrow(<-0.5*1.33,0,1>,<0.5*1.33,0,1>,pigment{Red transmit 0.8})
text {ttf "timrom.ttf", "Right", 0.01,0
scale <0.08,0.1,1>
translate <0.1,0.04,0>
pigment {Red}
}
// the up vector
Arrow(<0,0,0>,<0,1,0>,Blue)
Arrow(<0,-0.5,1>,<0,0.5,1>,pigment{Blue transmit 0.8})
text {ttf "timrom.ttf", "Up", 0.01,0
scale <0.08,0.1,1>
translate <0.1,0.05,0>
rotate <0,0,90>
pigment {Blue}
}
Post a reply to this message
|
![](/i/fill.gif) |