#Hellppp! with Matrix
8 messages in this thread
I sent a mesage last week but have not heard anything yet so here it is again
with additional questions.
I have written a IPAS routine to access the objects mesh min and max X,Y,Z
values. However, the values appear to be in object local co-ordinates and I
need the world co-ordinate XYZ values (as in the ASC file).
I tried to multiply the matrix that is in the item mesh structure with the
min/max values, but the results were not what I expected.
What I expected was the values that are displayed when moving the cursor over
the shape when running 3DS (or that come out of the ASC file).
Can you tell me what I am doing wrong and if I don't need the matrix now, when
would I need it ?
I want to calculate the range of each camera in the scene ie the camera cone.
Given the camera and target co-ordinates and the FOV I thought I could work out
the rectangle that will surround the target position. However, when I finally
got some real data I saw two things
1. The rectange is not consistant in a X,Y,Z ratio
How is this calculated and can I reproduce it ???
2. The direction of the camera to target is variable. Is there a way for me
to detect in which direction the camera is facing ie what axis the FOV is
related to.
Also, we are running the seez.ixp and we are finding color in the output file.
Any ideas ?
Can you recommend other books that will give me detailed info on the above
areas ?
Thanks in advance
Hi John,
Dave Marks has done a lot of work with z-buffering. Perhaps he will jump in
here. I would be very interested in taking a look at your routine when you have
somthing working (even in the alpha stages).
Lee
Hi John,
Hi John,
<< ..but have not heard anything yet..>>
Please see msg #186447. I answered you on Friday Aug 18tht. 8:42:24 am. 🙁
<< .. routine to access the objects mesh min and max X,Y,Z values. However,
the values appear to be in object local co-ordinates and I need the world
co-ordinate XYZ values (as in the ASC file). >>
If you have R4, check out the following 2 keyscripts written by Tom Hudson
which offers insights into your problem.
;———————————————————–
; PIVOT.K3D
; Pivot Point Alteration Demo (Object Space Version)
; 3DStudio R4
; 940708
; Tom Hudson
;
; This program demonstrates how to alter the pivot point of an object.
;
; Pivot points are stored in the local coordinate system of the object. The
; pivot point of an object is the alignment point used for the location of
; the position keys. If we alter the pivot point, the position keys must
; also be adjusted accordingly, or else the objects will shift position after
; the pivot is altered. In order to avoid a shift, it is necessary to
; transform the old and new pivot points through the object's transformation
; matrix. This gives the new pivot point's offset from the old pivot point
; in world coordinates, where X is left/right, Y is front/back and Z is
; bottom/top. Once this value is calculated, the position keys are adjusted
; accordingly.
;
; See PIVOT2.K3D for a demonstration of setting the pivot point to a world
; coordinate.
<< 1. The rectange is not consistant in a X,Y,Z ratio
How is this calculated and can I reproduce it ??? >>
File Info for CAMERA.ZIP
Section: Software Dev. Kits Contributor: 73172,1351 Size: 7511
Submitted: 5/19/94 Type: Binary Accesses: 92
Title: Thread outlining a test of 3ds FOV
Keys: 3DS FOV CAMERA
A thread primarily between John K. Jordon and Michael E. Bartlett and their
scientific
experiments to test the accuracy of 3DS' cameras FOV.
<< 2. The direction of the camera to target is variable. Is there a way for
me to detect in which direction the camera is facing ie what axis the FOV is
related to. >>
There's a script in Inside 3DS for Release 4 that may help you….
'
'———————————————————–
' CAMTRACK.K3D
' Keeping Objects Perpendicular to a Camera's Position
' An "Inside 3D Studio" utility
' By: Jonas Ruikis
'
' CAMTRACK rotates a selection of objects about their pivot point (of course)
' so their first face is prependicular to a selected Camera's position.
' Axes may be locked for the objects.
' Either the camera and/or the objects may be in motion.
' Respects the current Time Segment
jonas[adesk]
Jonas, Jumping in here a minute. I am having a similar problem in a sxp that im
working on I need to transform object coordinates to world coordinates for
calculation. can you suggest some examples, and/or rerading to help me with
this. Kevin
Hi Kevin,
<< I am having a similar problem in a sxp that im working on I need to
transform object coordinates to world coordinates for calculation. can you
suggest some examples, and/or rerading to help me with this. >>
Check out message# 186496, #186512, #186529.
In addition, Martin message #186679 offers you the best clue on how to handle
this.." you'll have to devise a way of getting the transformation information
to the SXP script (again, the SXP has no access to scene information, so you
have to spoon feed it)…"
One variation on the spoon_feed approach offered in the past was a combination
KXP and SXP. You'd run the KXP first and it's job would be to analyze the scene
and store object per frame data out to a file. Then at rendertime, your SXP
could read the file and alter it's behaviour on each frame based on the
prestored data. This workaround overcomes the limitation of an SXP not having
access to the complete scene info at rendertime.
jonas[adesk]
Hi John,
<< I have written a IPAS routine to access the objects mesh min and max X,Y,Z
values. However, the values appear to be in object local co-ordinates and I
need the world co-ordinate XYZ values (as in the ASC file). >>
In addition to my previous post, the following file demonstrates the use of
Local and World coordinate bounding boxes.
File Info for ALIGN.ZIP
Section: Scripts Contributor: 73172,1351 Size: 7825
Submitted: 2/17/95 Type: Binary Accesses: 226
Title: Planet Studio: Align script
Keys: PLANET STUDIO ALIGN K3D SCRIPT PHILLIP MILLER
Align script for Planet Studio. Align one or more objects in the keyframer.
;
;Alignment by Object Bounding Box Extents!
;by Phillip Miller
jonas[adesk]
Before I answer, let me qualify this with a statement that I have not done IPAS
programming, and my knowledge of the mathematics involved is limited, but
rapidly catching up.
I HAVE done some script programming so I CAN offer some ideas that may help…
>> I need the world co-ordinate XYZ values (as in the ASC file). <<
The Script Extensions (TSE) offer a parameter that allows you to call the
Bounding Box in either local or world coords. If the IPAS API doesn't allow
that, you will have to use a combination of the local axis (in world coords)
together with the transformation matrix to determine the BBox coords.
>> 1. The rectange is not consistant in a X,Y,Z ratio <<
I believe the camera aspect ratio is determined by the render settings.
Someone with more IPAS knowledge will have to fill you in with details on
actual calculation of the camera cone…
>> Is there a way for me to detect in which direction the camera is facing <<
In TSE a camera structure has separate coords for camera and target. It
should be a fairly basic calculation between two points to determine the
camera-target vector.
>> …seez.ixp and we are finding color in the output file. Any ideas ? <<
If you need pure grey-scale, try turning off your gamma correction. I'm
guessing here, but possibly the gamma correction curves are slightly shifting
the colors.
FWIW, the z-buffer is VERY easy to access via TSE (and I'm guessing IPAS as
well). Given a z-buffer value, it is relatively easy to generate any color
spectrum you prefer. It's all a matter of percentages and basic math.
Hope this helps.
– Dave
Hi David,
<< Someone with more IPAS knowledge will have to fill you in with details on
actual calculation of the camera cone…>>
The calculation found in the IPAS 4 toolkit relating to cameras states on pg 39
"Note: For historical reasons involving compatibility with the ACAD program,
the relationship between FOV and focal length in the 3D Studio program is
defined as follows: Focal Length = 2400/FOV. For accurate camera placement,
IPAS applications perform their calculations in terms of FOV and then set the
focal length to be 2400/FOV in degrees."
Other data available include the camera location as well as target position in
world coordinates, camera roll angle, and the focal length in millimeters..but
no definition of the cone.
jonas[adesk]