You are Here:Home>>Old Posts>>Tutorial – Knowing Papervision3D

Tutorial – Knowing Papervision3D

Carlos Pinho
By | 2008-02-18T16:54:27+00:00 Feb 18, 2008|Old Posts|

Currently there are many open source projects in the world flash. I myself am doing one or some, I do not know right now, (my problem is how many of them ends). And a project that was very interesting is currently papervision3d. You can create 3D applications and sites, games and others. Still being created its first version. And to download it is necessary to be registered. Without counting still in this SVN. In this tutorial, you will learn to make a simple application to understand the functioning of this engine 3d graphics. Not go into any details as to the use of 3D objects exported the max, since this is possible but it is not the case of this tutorial. But for now go adiantando is not complicated and you can learn to do this by following this tutorial other in English: Remembering papervision that is not yet released then may make mistakes or certain things like support the animation of fuses is not supported.

Download the latest version of papervision, after it creates a new file in Flash CS3, (not work with earlier versions), enter the path to the engine in the document (publish -> settings. Action Script Version… settings. Classpath add V and direct to the folder where you left the source. Example: D: papervision as3 trunk src).

Create a script file of the type and save in the same folder where the file was saved previously created with the name of PapervisionTutorial.

package {
import flash.display.Sprite;
import org.papervision3d.scenes.Scene3D;
import org.papervision3d.cameras.Camera3D;
import org.papervision3d.objects.Plane;
import org.papervision3d.materials.MovieAssetMaterial;

We created a package and import all classes necessary for our application. The idea that we will apply this tutorial is not intended to create an example that does several things, but a simple plan on the screen, and view important that you understand what you are doing.

Here We import the classes of flash Sprite and Event that use it to create body visible on stage and a loop for the engine respectively. Then there are the imports of the engine. Scene3D will be our scene, Camera3D our camera, Plane with a plan and we finally have MovieAssetMaterial establishing a material from a movieclip not instantiated. For good development with the engine it is important that we look at the classes in each of the sub-packages which belongs. In such objects have the Class ASE used to import 3D models that can be created in programs such as Blender, 3D Max, and Maya.

public class PapervisionTutorial extends Sprite { Public class PapervisionTutorial extends Sprite (
var container:Sprite; Var container: Sprite;
var scene:Scene3D; Var scene: Scene3D;
var camera:Camera3D; Var camera: Camera3D;
var material:MovieAssetMaterial; Var material: MovieAssetMaterial;

Our class and the objects that we use.

function PapervisionTutorial() { PapervisionTutorial function () (
container = new Sprite(); Container = new Sprite ();
addChild( container ); AddChild (container);
container.x = 385; Container.x = 385;
container.y = 225; Container.y = 225;

Constructor, created a container where renderizaremos the scene. We put on stage in the middle of it. This is. As my is with the size of 770 x 450 figures are as shown. If you want other size stage then divide figures.

scene = new Scene3D( container );
camera = new Camera3D();
camera.zoom = 4;
material = new MovieAssetMaterial( “example”, true );
var plano = new Plane( material, 500, 500, 2, 2 );
scene.addChild( plano );
this.addEventListener( Event.ENTER_FRAME, loop3D );

We created the scene, the camera, with zoom equal to 4, and material, (this material you should create a movieclip preferably a movement that has any, and the library linka it as example). After all created a plan with this texture, (if you want can use wire as texture, just leave a null texture). He has size of 500 x 500, and is divided into blocks, 2 blocks horizontally and 2 blocks upright. Added the scene and created by the loop end, (we always important EnterFrame: D).

function loop3D(event:Event):void {
scene.renderCamera( camera );
} )

Our method loop3D could only have a called method. Only renderCamera. We call updateBitmap as as the name already says, only to upgrade the texture of our plan. If our plan is not moving in its texture is recommended not to do this update since spent processing. If you only want to render an image and not create any animation, could then fail to do the loop and put only a call to renderCamera.

} )
} )

Ready. Control + Enter.

Next post on papervision see movements and animations.

Source Files

More information and tutorials in English visit:

The Original Tutorial was write in Portuguese, and can be found here.

About the Author:

Carlos Pinho
A father, a husband and a geek... Carlos was the founder of projects like The Tech Labs and Flash Enabled Blog. He is the founder of TekTuts He is passionate about technologies. Their main skills are in analytics, transport & logistics, business administration. He also writes about programming resources, trends, strategy and web development.