“Be inspired, enjoy your work, keep learning and never forget to play.” — gskinner

PV3D 2D->3D , 3D->2D

Posted: July 16th, 2009 | Author: Tiago Bilou | Filed under: 3D, Actionscript3, Papervision3d | 4 Comments »

This week I finally had a project that involved 3D (about time too).
Since it involved interacting with 3D models, using Flash 10 was out of the question. So I opted to go with papervision, instead of away3D or alternativa3D, since this was the engine we where more accustomed to.

Sometime along the development of the application I came across the need to convert 3D coordinates into 2D screen coordinates and also the opposite. It's nothing new and it's already implemented in papervision, but since it took me a little while to find it, I decided to share it.

Getting the 2D Screen coordinates from a DisplayObject3D

Since papervision 2.0 that every DisplayObject3D has a property called "screen", that will return the coordinate of the object on screen. Whenever I tried to access the screen property the number3D I got back was always (0,0,0). Probably because it's an expensive operation and it's something you only need sporadically, papervision will not calculate this automatically. You need to ask papervision yourself to calculate this coordinates. To do so, just use the "calculateScreenCoords" of the do3d

myDisplayObject3D.calculateScreenCoords(camera)

Now when you try to access the "screen" property you will get the number3D with the screen coordinates for your DisplayObject3D.

Getting the 3D coordinates from a 2D point (x,y)

For this one I found a great post by zupko that tells you exactly what you need to do.
In a nutshell, you need to take your 2D coordinates (x,y) and convert them into a direction vector. Having the vector and the camera position you can create a ray (line) that will go from the camera into infinity. Next you need to specify the Z, or in another words, where do you want to stop on that line. Zupko uses a 3D plane to do that using the "getIntersectionLineNumbers"

Just remember papervision's 3D Zero (0,0,0) is at the center of the screen and not on the upper left corner like the 2D Zero (0,0)


pv3d gallery for actionscript 3 project

Posted: November 9th, 2008 | Author: Ivan Valadares | Filed under: 3D, Actionscript3, Code, Papervision3d | 2 Comments »

I start working on a photo library in papervision, so I look around I got an example from flashEnabledBlog, one of the problems was that the example was in flash cs3 and I need it in flex actionscript project, the other one was that the example was done with old papervision and tweener versions, so I had to port it. It’s a good start if you have to do something like it. I Include lasted versions of Tweener and Papervision in the zip file, you just have to run it.

pv3d_gallery_as3project


Interview with Rob Bateman (Away3D)

Posted: May 21st, 2008 | Author: Idoru | Filed under: 3D, Articles, Away3d, Flash 10, Interviews, Pixel Bender | Tags: , , , , | 1 Comment »

Dreaming in Flash interviewed Rob Bateman, The Chief architect and co-founder of the Away3D engine, on his views about the upcoming release of Flash Player 10 and how it will affect Away3D.
Read the rest of this entry »


Papervision3d GW Memory Leak

Posted: February 19th, 2008 | Author: Idoru | Filed under: 3D, Actionscript3, Papervision3d, WorkAround | 12 Comments »

Yesterday I came across a nasty leak with GW, it just wouldn't kill my moviematerials after I removed all the references to them, I tried it all, removeChild, removeListener, weak keys... you name it.

So I finally decided to go have a look at Papervision's destroy methods, and surprise surprise they weren't being called, no harm there, it's alpha these things are meant to happen :)

So here's what you have to do to force those destroy methods to execute, and clean your memory.

In org.papervision3d.core.proto.MaterialObject3D  set the destroy method from protected to public, do the same to all the materials that you use, like org.papervision3d.materials.MovieMaterial . When you're done with these just the destroy method in your class. For me it looks something like this:

Hope this helps.


WOW meets Papervision3D

Posted: January 23rd, 2008 | Author: Idoru | Filed under: 3D, Actionscript3, Demo, Papervision3d, Physics Engine, WOW-Engine | 2 Comments »

WOW was released today, in case you don't know what WOW is let me quote a little description from WOW: "WOW-Engine is a free AS3 open source physics engine written by Seraf ( Jérôme Birembaut ) capable to handle positions in a 3D environment."

We've all been waiting for this moment for a very long time, to have physics
and 3D come together, so without further due here's a little demo I've thrown together in an hour or so.

The code will follow shortly, I just need to tidy it up :) .

demo

Enjoy.


Papervision 2.0 PhongCube Demo

Posted: December 5th, 2007 | Author: Idoru | Filed under: 3D, Actionscript3, Demo, Papervision3d | No Comments »

Today a milestone in the internet world was achieved, Papervision 2.0 Alpha codename GreatWhite is out :)

So here's a little demo on the new Phong shader :) As soon as i have the time tonight i'll put on a much nicer one. This is just to show that altough PV3d just got a new whole set of features it's still easy to use :)

PhongCube


Papervision3D Branches

Posted: November 15th, 2007 | Author: nuno | Filed under: 3D, Actionscript3, Papervision3d | 11 Comments »

Inside the Papervision3D source, besides existing an AS2 and AS3 version, there are five derivate branches: MaterialsRestructor, Phunky, ascollada, frustrum and timk_frustum. I decided to research a bit about each one and write about what I founded..

The most important of these branches is the one called Phunky. It is the branch that will soon became the 2.0 version of Papervision3D, which in the SVN trunk is now tagged Beta 1.7 (dated 20.08.07). So, if you're using trunk, you should expect only bug-fixes. It's a bit different from other open-source projects where trunk normally means the latest revision of the project. For Papervision3D, you can think of trunk as a stable version (whatever that means for a software that's in Beta).

Someone said on the list that "switching from trunk to Phunky shouldn't break anything (doesn't impinge on the API) but should net you a performance increase".

MaterialsRestructor was a branch created to test code regarding Materials. Once changes are tested the most likely is that they go into trunk or Phunky.

I don't know much about the 'ascollada' branch besides the fact that it was created by Tim Knip and that he tries to maintain it in sync with ascollada, a actionscript library for parsing COLLADA files. I've tested loading some COLLADA files with Beta 1.7 and it works fine so I don't have the need to use this branch yet but Ivan is using it (the DEA class), so he might have something to add here.

The 'frustum' (definition) branch has a 'BVH mocap importer class' with a beautiful sample here, but I was unable to find the real purpose of this branch. You can check the examples folder for the sample sources.

'timk_frustum' is a branch that appeared when Tim Knip put up for testing a new FrustumCamera3D, in early August 2007. This class is now also at the 'frustum' branch.

And that's it. If you know more about this and want to share please do. Thanks.

Update: John Grden posted a comment explaining a bit more about the branches, thanks!


Carrousel How-to

Posted: July 31st, 2007 | Author: Idoru | Filed under: 3D, Actionscript3, Code, Experiments, Papervision3d, Tutorial | 6 Comments »

Hi there,

First be sure you have either flash cs3 or flex2 installed on your machine, then you'll want to download the Papervision3d engine.

Now we can get started :)
Look in the code for instructions :)

Download Actionscript source file

And that's it, if you have any questions please post them!! :) We'd love to hear from you.
Lo.


The mighty carrousel!

Posted: July 30th, 2007 | Author: Idoru | Filed under: 3D, Actionscript3, Experiments, Papervision3d | 2 Comments »

This is a rework of the carrousel that Lee did over at flashblog. I've added the extra blur effect and a little revamp of the calculations for the plane rotation.

Code to come soon.