View Full Version : Projecting 3D coordinates to 2D view frame??

 ristopuukko08 August 2005, 05:18 AMHello people. In to the problem: I'm currently working with web graphics (mixing 3D content with flash with program called "Blaze 3D Studio" - http://www.holomatix.com ) and what I would like to achieve, is to be able to track the movement of a 3d object of my choice (while the user rotates the object) in to X,Y coordinates of the frame, where the content is shown. I can track separate 3D objects from a model quite easily and I would do "hot spots" in to the model, but I would like to mark them some how, so that the user doesn't have to "find" them accidentally. I have an access to any objects matrix information via Flash actionscript and I've been trying to get some sence out of them (for example: http://en.wikipedia.org/wiki/3D_projection) but since I'm not a robust 3D programmer I must have some advice in this matter. So, any help will be most welcome. /Risto
ThE_JacO
09 September 2005, 03:38 AM
I don't know flash and I don't know what libraries, SDK or helpers you're using, but from a purely abstract point of view converting from 3d space to raster space is just a matter of chaining up some matrices and a quadrivector (which can be encapsulated in a matrix4 if you don't have a quadrivector object in the SDK)

the implementation side of this depends a lot from what helpers you have access to.
IE in most decent 3D apps you have methods like myPointsPosArray.remapToWorldSpace(newPosArray)

which would spare you from the first step of 3DtoRaster (local to world transform).

when that is done another set of transformations is used to transform further into a coordinates frameset that corresponds to the camera's space, and at that point all you need to do is multiply every point's quadrivector (it's position vector in homogeneous coordinates) by your matrices.

now... what steps are you having problems with, and what kind of things can you leave to the SDK and which ones you need to do yourself? last but not least, do you have a grasp on at least the basics of linear algebra? or you're trying to do this without a clear idea of how transforms and reference frames work?

ristopuukko
09 September 2005, 05:25 AM
Hi and thanks for the reply

the implementation side of this depends a lot from what helpers you have access to.
IE in most decent 3D apps you have methods like myPointsPosArray.remapToWorldSpace(newPosArray)

the tools are (in my understanding) not so big but you can get there, I believe

These are the major tools: objects Matrix3D - class and Vector3D - class, defined here

which would spare you from the first step of 3DtoRaster (local to world transform).

when that is done another set of transformations is used to transform further into a coordinates frameset that corresponds to the camera's space, and at that point all you need to do is multiply every point's quadrivector (it's position vector in homogeneous coordinates) by your matrices.

now... what steps are you having problems with, and what kind of things can you leave to the SDK and which ones you need to do yourself? last but not least, do you have a grasp on at least the basics of linear algebra? or you're trying to do this without a clear idea of how transforms and reference frames work?

I think this will reveal the true nature of the problem; this the code the guys from Holomatix provide to be used for the basic object rotation: http://www.holomatix.com/codesamples/Standard%20Navigation.txt

As I understand, I have to do the matrix translations all by myself, and its been fifteen years since my last matrix-mathematics lecture, so i'm a little bit tight spot here...

/risto

daniel_arz
09 September 2005, 11:59 PM
I'm currently working with web graphics (mixing 3D content with flash with program called "Blaze 3D Studio"

Hey ristopuukko,
This Blaze 3d program seems awesome. When did you find out about it and are there other competing programs like it that work well with flash?

d

ristopuukko
09 September 2005, 05:27 AM
Hi daniel_arz

yep the tool is quite good at mixing pure 3D content with Flash-made layouts.
I'm a graphics designer in a finnish desing company called Satama Interactive (http://www.satama.com) and I've met this Blaze3D first time here. I've done several projects with it and the workflow is basicly very well defined.

The best part of the Blaze is that it is NOT flash what comes out of it!
The program "hijacks" the functionality from the swf-files and creates a java applet, which is basicly a stand-alone 3D motor (just like in the games) and the author can use actionscript to take any functionality out of it as needed. Its the freedom, baby!!!

And the ligthing is awesome! It uses nothing but HDR - imagery for ligthing and with a little tweaking it looks great.

Download the program from the Holomatix and check out the numerous tutorials.

Only downside is that you need the Flash MX 2004 Professional edition for scripting; nothing else works.

And for the aother question check out this: