|
|
> I have a question:
> Is it possible to create a 2D-Text in the rendered image?
> I need a text which is always at the same position in the picture
> and does not depend on the camera-position.
> I want to create subtitles in an animation. Is this possible?
> Which directive must I use?
There are two approaches you could use: rendering the text into the
animation, or adding it after the animation is rendered. Both can be done
using POV-Ray; for the first option, you need to use a little code that will
position your subtitles so they always appear in the same apparent location,
e.g.:
#declare camera_location = [ from your camera statement ];
#declare camera_look_at = [ from your camera statement ];
#declare camera_sky = y [ or from your camera statement ];
#declare Z = vnormalize(camera_look_at - camera_location);
#declare X = vnormalize(vcross(vnormalize(camera_sky), Z));
#declare Y = vnormalize(vcross(Z, X));
text {ttf "Arial", "Copyright notice", 0.01, 0
pigment {rgb 1} finish {ambient 1 diffuse 0} no_shadow
scale 0.05 translate <.2, -.4, 1> // Adjust position and size
matrix <X.x, X.y, X.z, Y.x, Y.y, Y.z, Z.x, Z.y, Z.z, 0, 0, 0>
scale 1/100 translate camera_location}
The first three vectors should match your camera as it changes through the
animation, e.g. if you have:
camera {rotate <10, clock*360, 0>
location y*clock*20
look_at <0, sin(clock*2*pi*4), 0>}
you would replace this with:
#declare camera_sky = vrotate(y, <10, clock*360, 0>);
#declare camera_location = y*clock*20;
#declare camera_look_at = <0, sin(clock*2*pi*4), 0>;
camera {sky camera_sky location camera_location look_at camera_look_at}
From these declared values the camera matrix is calculated, which is used to
transform your subtitle object (this could also be a union, a
semi-transparent disc, etc.) so it sits very close to the camera, appearing
in a static location without affecting the rest of your scene.
The other method is to render your animation without subtitles first, and
then use POV-Ray to re-render the frames with an overlay, e.g.:
plane {z, 0 pigment {
image_map {tga concat("Frame", str(clock*[number of frames], -3,
0))}
translate -0.5 scale <4/3, 1, 1>}
finish {ambient 1}
}
text {ttf "Arial", "Copyright notice", 0.01, 0
pigment {rgb 1} finish {ambient 1 diffuse 0} no_shadow
scale 0.05 translate <.2, -.4, -1> // Adjust position and size
}
camera {orthographic right x*4/3 up y location -z*100}
Again, various objects/textures could be used for the overlay. The
advantage of this method is that you can keep a copy of the animation
without subtitles, although obviously extra rendering is required. The
first method means that anyone can render your animation with the
subtitles/overlays, and (using POV objects/textures) the overlays are
resolution independent.
Post a reply to this message
|
|