[Papervision3D] 2D coords from 3D in AS2

John Grden neoriley at gmail.com
Mon Jul 16 10:55:50 EDT 2007


and the other issue that makes calculating it less attractive is that when
you're doing the reverse projection, you have to calculate hit detection or
deal with sorting issues.

What if a if you have 2 other objects that are actually in the way?  *You*
know you can't see the face/object, but the object doesn't know this and
hence we have a major issue with calculating 3D to 2D.

So, it gets down to the actual faces level at this point, and I think using
the flash player's ability to dispatch mouse events in conjunction with face
containers starts to make alot of sense for this type use case.

But then, again, I'm thinking out loud ;)

On 7/16/07, Trevor Burton <worldofpaper at googlemail.com> wrote:
>
> Ok - here's a little tutorial... first of all a reminder about going from
> 2D to 3D:
>
> to take an object from 2D to 3D you need to make it smaller the farther
> away it is from the viewer, and vice versa - if we call the ratio of size to
> distance perspectiveRatio then you can calculate perspectiveRatio like so:
>
> perspectiveRatio = perspectiveDepth / (perspectiveDepth + z)
>
> where perspectiveDepth is a number that represents the distance from the
> viewer's eye to the screen (not really, but if you think of it like that
> it's simpler).
>
> and where z is the distance into the screen that the object is.
>
> The answer would seem to lie in Vertices3D's project() function -
>
>  on line 138 (in my latest copy - not sure if it's up to date) you'll find
> this line:
>
> persp  = focus / (focus + s_z) * zoom;
>
> followed by:
>
> screen.x = s_x * persp;
> screen.y = s_y * persp;
>
> so s_x and s_y should be the original co-ordinates of the object - before
> the perspective calculation is applied.
>
> i'll have a think about it and post a solution when i get time tonight...
> unless someone beats me to it.
>
> T
>
> On 7/16/07, John Grden < neoriley at gmail.com> wrote:
> >
> > yeah I would love it if someone could come up with that formula - I've
> > played and played and looked around for being able to do reverse projection
> > calcs( I call it that, but that's not the technical term for it I don't
> > think )
> >
> > I did talk to someone who had some experience with this and they seem to
> > indicate that the calcs would be exponential in that you'd have to calculate
> > rays back to the viewable area etc.  I haven't gone any further than that
> > unfortunately, and I'm not sure he understood the problem completely, but
> > his explanation did make some sense.
> >
> > In one test, I thought I had something going using Flash's 2D matrix,
> > but it quickly fell apart ;)  That 3D dimension is a fun one ;)
> >
> > On 7/16/07, jlm <jlm at justinfront.net> wrote:
> > >
> > > I have been looking for some way to get the corners of a plane into
> > > 2D, so I
> > > can use sandy's distort class to map a video, and then tween it to a
> > > quad
> > > shape.
> > >
> > > I found this but do not believe there is projection class in
> > > papervision
> > > as2, and I am not sure what object.relative would be.
> > >
> > > var v:Vertex2D = (new Vertex3D(0,0,0)).project(new
> > > Projection(Matrix3D.multiply(camera.getView(), object.relative()),
> > > camera.focus, camera.zoom));
> > >
> > > link
> > >
> > > http://groups.google.com/group/away3d-dev/browse_thread/thread/898a78770fc3911d
> > >
> > > trying to do something like
> > >
> > > private function release( _container )
> > > {
> > >
> > > // ideas on how to make this?
> > > var corners_array: Array = papervisionToGlobal( _container );
> > >
> > > renderVideo(corners_array);
> > >
> > > }
> > >
> > >
> > > any help appreciated.
> > >
> > > Thanks
> > >
> > > Justin
> > >
> > >
> > >
> > > _______________________________________________
> > > Papervision3D mailing list
> > > Papervision3D at osflash.org
> > > http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> > >
> >
> >
> >
> > --
> > [  JPG  ]
> > _______________________________________________
> > Papervision3D mailing list
> > Papervision3D at osflash.org
> > http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> >
> >
>
>
> --
> Trevor Burton
> http://www.paperworld3d.com
> _______________________________________________
> Papervision3D mailing list
> Papervision3D at osflash.org
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
>


-- 
[  JPG  ]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/papervision3d_osflash.org/attachments/20070716/854b8bd8/attachment.html 


More information about the Papervision3D mailing list