|
|
Based on John VanSickle's code I made another code
which supports angle and sky and direction and which I
think is easy to use. Just #declare the following:
// These #declarings are optional:
#declare camera_location = <0,3,6>;
#declare camera_direction = <0,0,1>;
#declare camera_right = 4/3*x;
#declare camera_up = y;
#declare camera_sky = <1,7,0>;
#declare camera_angle = 50;
#declare camera_look_at = <0,1,0>;
// This #declaring is required:
#declare autotext_object =
text {
ttf "crystal.ttf", "Copyright 1998 YourName", 0.001, 0
pigment {color rgb 1}
finish {ambient 1 diffuse 0}
translate 0.2 // little distance from origin to text.
scale 0.07 // this value controls the size of the text.
translate <-4/6,-1/2,0> // place at the lower left corner.
}
Then paste or include this:
#ifndef (camera_location) #declare camera_location = <0,0,0>; #end
#ifndef (camera_right) #declare camera_right = 4/3*x; #end
#ifndef (camera_up) #declare camera_up = y; #end
#ifndef (camera_direction) #declare camera_direction = z; #end
#ifndef (camera_sky) #declare camera_sky = y; #end
#ifndef (camera_angle) #declare camera_angle =
degrees(atan2(vlength(camera_right)/2/vlength(camera_direction),1))*2; #end
#ifndef (camera_look_at) #declare camera_look_at = z; #end
#declare autotext_t = camera_location;
#declare autotext_z = vnormalize(camera_look_at-camera_location)/2
*vlength(camera_right)/tan(radians(camera_angle/2));
#declare autotext_x = vnormalize(vcross(camera_sky,autotext_z));
#declare autotext_y = vnormalize(vcross(autotext_z,autotext_x));
object {
object {autotext_object}
no_shadow
translate z
scale 0.001
matrix <
autotext_x.x,autotext_x.y,autotext_x.z,
autotext_y.x,autotext_y.y,autotext_y.z,
autotext_z.x,autotext_z.y,autotext_z.z,
autotext_t.x,autotext_t.y,autotext_t.z
>
}
camera {
location camera_location
right camera_right
up camera_up
direction camera_direction
sky camera_sky
angle camera_angle
look_at camera_look_at
}
The autotext_object can be any objects.
They should be placed within the range of
the up and right vectors. (<0,0,0> is the
center of the image.)
Regards,
Rune S. Johansen
http://hjem.get2net.dk/rsj
Post a reply to this message
|
|