|
|
Thanks John. I've been experimenting with this and have noticed some
"problems". I don't quite have a full picture of what the matrix command is
doing, so I haven't been able to solve these problems on my own.
1) With a CamZoom of 2.5, I see no distortion in the sphere. At CamZoom = 1,
I can see the sphere beginning to distort. With low CamZooms of 0.1, the
sphere gets really stretched out. It looks like it's being stretched towards
a vanishing point at the center of the field of view. Perhaps it is alway
stretched parallel to CamD, but it isn't noticeable when the zoom is high
and the camera is far away.
2) If CamLoc is located along the Y axis, I get "error: Singular matrix in
MInvers."
3) I notice with text (replacing the sphere) that has depth, that the depth
is more visible the further the text is from the center of the field of
view. I can give the text an aribrarily small depth , but it would be nice
to be able to give it zero depth so it is always flat. Is there a way?
4) I need a fudge factor, greater than 1, in the camera location position,
otherwise the text disappears. I think it is directly to the right of the
camera and therefore is not in the field of view.
Attached are the two files as I've modified them. The first covers questions
1 and 2 and the second, 3 and 4.
Thanks.
File one:
#version 3.1
global_settings { assumed_gamma 2.2 }
global_settings { ambient_light 1 }
#include "colors.inc"
#include "textures.inc"
background { color SteelBlue }
#if (clock = 0)
#fopen InfoFile "cam.txt" write
#write (InfoFile "Cam Info File\n\n")
#end
#declare CamSky=y;
#declare CamZoom=.1; // the length of the direction vector in the
// camera
// if you're accustomed to setting the zoom with the angle setting, then
// use this line to set the camera zoom instead:
//#declare CamZoom=.5/tan(radians(CameraAngle/2));
#declare CamLoc=<-325,-650,-325>; //MyCameraLocation; // wherever you're
putting it
//#declare CamLoc=<0,-650,0>; //camera in Y axis
#declare CamEye=<0,0,0>;//MyCameraLookAt; // wherever you're looking
#local CamD=vnormalize(CamEye-CamLoc); // direction of camera view
#local CamR=vnormalize(vcross(CamSky,CamD)); // to the right
#local CamU=vnormalize(vcross(CamD,CamR)); // camera up
camera {
direction CamD*CamZoom
right CamR*4/3 // 4/3 is my aspect ratio
up CamU
location CamLoc
}
light_source {CamLoc color White translate <-150, 0, 0>}
//sphere { <0, 0, 0>,25/CamZoom} // sphere at origin
sphere { <0, 0, 0>,.025
//box { <-.025, -.025, -.025>, <.025, .025, .025>
no_shadow // subtitling shouldn't cast shadows in the scene
pigment { rgb <1,1,0> }
//finish { ambient 0.5 diffuse 0 } // keeps appearance consistent as
// camera moves
//scale <1, 1, .001>
//rotate <45, 45, 0>
translate <2/3-.05,1/2-.05,CamZoom>
//translate <0, 0, CamZoom>
matrix < CamR.x, CamR.y, CamR.z,
CamU.x, CamU.y, CamU.z,
CamD.x, CamD.y, CamD.z,
CamLoc.x,CamLoc.y,CamLoc.z >
}
#ifdef (InfoFile)
#write (InfoFile "CamD = ", CamD.x, ", ", CamD.y, ", ", CamD.z, "\n")
#write (InfoFile "CamR = ", CamR.x, ", ", CamR.y, ", ", CamR.z, "\n")
#write (InfoFile "CamU = ", CamU.x, ", ", CamU.y, ", ", CamU.z, "\n")
#write (InfoFile, "\n")
#end
#fclose InfoFile
File two:
#declare CameraLocation = <-325, -650, -325>;
#declare CameraLookAt = <0, 0, 0>;
#declare CameraSky = y;
#declare CameraVector = CameraLocation - CameraLookAt;
#declare CameraZoom=1; // the length of the direction vector in the
#local CameraDirection=vnormalize(CameraLookAt-CameraLocation); // direction
of camera view
#local CameraRight=vnormalize(vcross(CameraSky,CameraDirection)); // to the
right
#local CameraUp=vnormalize(vcross(CameraDirection,CameraRight)); // camera
up
camera {
location CameraLocation*1.015 // need a fudge factor here, otherwise text
disappears
right CameraRight * 4/3
up CameraUp
sky CameraSky
direction CameraDirection * CameraZoom
//look_at CameraLookAt
}
#version 3.1
global_settings { assumed_gamma 2.2 }
global_settings { ambient_light 1 }
#include "colors.inc"
#include "textures.inc"
background { color SteelBlue }
#declare LightCt = 6;
#declare i = 0;
#while (i < LightCt)
light_source {<600, 0, -400> color Gray50 rotate <0, 0, 360 / LightCt *
i>}
#declare i = i + 1;
#end
#declare uclock = 83.456;
// clock display
#local ClockHours = int(uclock / 3600);
#local ClockMinutes = int(uclock / 60) - (ClockHours * 60);
#local ClockSeconds = uclock - (ClockHours * 3600) - (ClockMinutes * 60);
#local ClockString = concat(str(ClockHours, -2, 0), ":",
str(ClockMinutes, -2, 0), ":", str(ClockSeconds, -6, 3))
text {
ttf "d:\winnt\fonts\cour.ttf" ClockString 1, <0, 0, 0>
scale <1, 1, 0.001>
translate <4-3.5,-5.5,0>
no_shadow // subtitling shouldn't cast shadows in the scene
matrix < CameraRight.x, CameraRight.y, CameraRight.z,
CameraUp.x, CameraUp.y, CameraUp.z,
CameraDirection.x, CameraDirection.y, CameraDirection.z,
CameraLocation.x,CameraLocation.y,CameraLocation.z >
}
"John VanSickle" <van### [at] erolscom> wrote in message
news:39D1E67D.A5F697DD@erols.com...
> Bill Brehm wrote:
> >
> > I want to place a stop watch type counter in the lower right corner of
> > an animation. I has the animation working and the stop watch text too.
> > I have some problems:
> >
> > 1) I can't figure out the formula for rotating a text object so it is
> > parallel to the image plane and upright as the camera sees it. I've
> > tried all kinds of vector functions, be can't figure it out.
>
> It's simpler to use a matrix transform. All but one of my IRTC entries
> has subtitling of some kind, so I make heavy use of this.
>
> > 2) Ideally, the rotation and position and size of the text object
> > should be based on camera parameters, like look_at and position and
> > sky, etc., so I can move the camera and have the stopwatch stay in the
> > same location on the images.
>
> This is how I do it.
>
> #declare CamSky=y;
> #declare CamZoom=2.5; // the length of the direction vector in the
> // camera
>
> // if you're accustomed to setting the zoom with the angle setting, then
> // use this line to set the camera zoom instead:
> #declare CamZoom=.5/tan(radians(CameraAngle/2));
>
> #declare CamLoc=MyCameraLocation; // wherever you're putting it
> #declare CamEye=MyCameraLookAt; // wherever you're looking
>
> #local CamD=vnormalize(CamEye-CamLoc); // direction of camera view
> #local CamR=vnormalize(vcross(CamSky,CamD)); // to the right
> #local CamU=vnormalize(vcross(CamD,CamR)); // camera up
>
> camera {
> direction CamD*CamZoom
> right CamR*4/3 // 4/3 is my aspect ratio
> up CamU
> location CamLoc
> }
>
> sphere { <2/3-.05,1/2-.05,CamZoom>,.025
> no_shadow // subtitling shouldn't cast shadows in the scene
> pigment { rgb <1,1,0> }
> finish { ambient 1 diffuse 0 } // keeps appearance consistent as
> // camera moves
> matrix < CamR.x, CamR.y, CamR.z,
> CamU.x, CamU.y, CamU.z,
> CamD.x, CamD.y, CamD.z,
> CamLoc.x,CamLoc.y,CamLoc.z >
> }
>
> > 3) I want to do the stopwatch in such a way that it doesn't have any
> > perspective distortion. Ideally, it should look like it was
> > superimposed on the image after the rendering.
>
> This is only a problem with a wide camera angle, and then only if your
> object is lengthy along the z axis.
>
> > Any help is appreciated. Thanks, Bill.
>
> Hope this helps,
> John
Post a reply to this message
|
|