Papervision3D 2.0 Released – Great White

New branch in the googlecode repo: http://papervision3d.googlecode.com/svn/trunk/branches/GreatWhite/

Well, if you’re into 3D and haven’t heard the buzz about Papervision3D 2.0, you’ve probably been under a rock or working for an agency on a 6 week deadline in a room with blacked out windows. We’ve all waited for this release with much anticipation and it’s been a long wait, but that wait is FINALLY over!

Ralph and Tim have been cracking away at 2.0 and putting in amazing amounts of hours to do so – these guys haven’t slept much, so give em’ a break if you find bugs with the alpha release. This is the first alpha release PV3D has had and we’re hoping the community rallies around it and helps to test and improve the code base.

What’s new? Glad you asked.

  • Shaders,shaded materials
  • phong, flat, cell, gouraud shading
  • bumpmaping
  • Viewport3D
  • BasicRenderEngine
  • Adoption of ASCollada with DAE object
  • MD2 support
  • Frustrum Camera
  • re-write of render loop – now there’s render lists centeralized in the RenderEngine
  • refactored and greatly improved InteractiveSceneManager(ISM) – much faster

upgrading current projects:

If you’re going to try 2.0 with your latest project, you need to be aware of a couple of things:

1. Setting up the initial scene is different – in a good way🙂 You no longer create a sprite container to pass to Scene3D, nor do you pass a boolean value for interactivity to Scene3D. Viewport3D extends Sprite, and includes the ability to do:

  • auto resizing/centering
  • interactivity
  • autoClipping
  • autoCulling

[as]var viewport:Viewport3D = new Viewport3D(0, 0, true, false);
addChild(viewport);

var renderer:BasicRenderEngine = new BasicRenderEngine();

var scene:Scene3D = new Scene3D();
var camera:FreeCamera3D = new FreeCamera3D();[/as]

Then, when you want to render:

[as]renderer.renderScene(scene, camera, viewport);[/as]

The new Viewport3D really opens up the doors to do cool things like BitmapViewportMaterial – think of using a camera’s view as a material😉

[as]public function Viewport3D(viewportWidth:Number = 640, viewportHeight:Number = 480, autoScaleToStage:Boolean = false, interactive:Boolean = false, autoClipping:Boolean = true, autoCulling:Boolean = true)[/as]

2. The engine’s been refactored a bit and so you’ll have to go through and update your imports. Most notably, Objects have moved.

3. No more precision materials. Now all materials have a “precise” boolean. Just set it to true if you need precision.

[as]metalicBoxMaterial = new BitmapMaterial(boxTextureBitmap.bitmapData);
metalicBoxMaterial.precise = true;[/as]

Using shaders
[as]// create your light
var pointLight:PointLight3D = new PointLight3D();
pointLight.moveUp(350);
pointLight.moveRight(350);

// create your materials
var earthMaterial:MovieAssetMaterial = new MovieAssetMaterial(“earthMap”);
var earthBumpMaterial:MovieAssetMaterial = new MovieAssetMaterial(“earthMapBump2”);
// create shader
var earthShader:PhongShader = new PhongShader(pointLight, 0xFFFFFF,0x303030,20, earthBumpMaterial.bitmap, earthMaterial.bitmap);
// combine shader with original material, for a shaded material
var earthShadedMaterial:ShadedMaterial = new ShadedMaterial(earthMaterial, earthShader);
// add to sphere
var earth:Sphere = new Sphere(earthShadedMaterial, 250, 12, 12);

scene.addChild(earth);[/as]

I hope this helps the learning curve for 2.0! I’ll try and get the benchmark for 2.0 out there, but initially, an older revision of it was 23% faster than 1.9 Phunky!

  1. Thank you John and the team… absolutely great job!!! I just started porting my project up to 2.0
    Hopefully the documentation will follow soon😉 but your example helps to figure out first steps.

  2. Yeah I figured you’d be excited about viewports Erik😉 It’ll make what you’re producing much easier😉

    • Matthew
    • December 5th, 2007

    Congrats! I went to the NY thing this last weekend and it was a blast. PV3D is really fun and easy to play around with and I learned alot. I was actually in the middle of making a little planet for a project I’m doing at work, so this post is double helpful for me.

    I hope you got to see some of the city while you were here.

  3. Thanks John. LoL. I’ve seen all this amazing stuff with PV3D 2.0 and I want to try it all out but I’m “working for an agency on a 6 week deadline in a room with blacked out windows”.

    • Oliver
    • December 5th, 2007

    I put the GreatWhite release into a new blank project using FDT/Ecplise and all I get are tons of errors😦

    Any ideas ?

  4. Hey, nice to see that it doesn’t seem to eat up as much of my CPU!🙂

  5. @Oliver: yeah Ralph just im’d me about that, and he’s working on it right now

    Thanks for the heads up though!

  6. John thx for the examples. It’s looking great. Having fun with the shaders!

    @Oliver: Not all errors that FDT shows, are really problematic. There are some though you have to fix, otherwise FDT won’t accept certain classes. e.g. in the ViewPort3D class you’d have to change the used namespace to just pv3dview (and organize imports to include the path). There will still be some errors, but a lot of them cause neither compile- nor runtime errors if you compile with the IDE.

    • Oliver
    • December 5th, 2007

    I finally made it. I think FDT is confused by import statements with a *. And the custom namespace thing was also a problem.
    I fixed all exept the errors thrown for :: don’t know what to do in this case.
    Anyhow, thanks for your great work !

    And please contact powerflashers for free prof. FDT licenses😉

  7. First, tx to the pv3d guys and to this blog for the fast turn around.

    I did my first example, and I got:

    “Papervision3D Public Alpha 2.0 – Great White (3.12.07)

    PV3D 2.0a WARNING : DO NOT USE WITH BETA 9 PLAYERS. ONLY WITH OFFICIAL TO TEST.
    CHECK YOUR VERSION!
    DisplayObject3D: null
    DisplayObject3D: null”

    Any idea?

    I am on Vista, Flash CS3 and the Flash Player (production) : 9,0,115,0.

  8. @Jeremy: yeah, that’s normal – nothing’s wrong. Ralph ran into a zillion bugs with the newest beta player 9 and decided to warn everyone with a friendly trace to be sure to NOT test with that version of the player. if you’re testing in the flash IDE, it shouldn’t be an issue.

  9. Oh yeah! Christmas came early this year! Rock on John (and all pv3d crew!!)🙂

    • Cezet
    • December 6th, 2007

    Great White is cool and it seems faster than phunky. But there is no interactiveMovieMaterial any more. How can asign mouseevent to for example front wall of cube?

  10. Great ‘rocker’ stuff, thanks a lot.

    I know you are all pretty busy but do you have a idea how long it will take to update the examples and documentation to v2.0 “alpha” ?

  11. @Cezet: Interactive and Precision material files have been removed and now there are boolean flags on the materials if you want either:

    myMaterial.interactive = true;
    myMaterial.precise = true;

    If you want interactivity in 2.0, you have to set your viewport to be interactive:

    var vp:Viewport3D = new Viewport3D(640, 480, false, true);
    // the 4th argument is ‘interactive’

  12. I would assume that when we get into Beta and we’re sure that the 2.0 public api is not going to change, we’ll update docs at that time. I’ll try and get the samples updated in the coming days.

    • Cezet
    • December 6th, 2007

    Thanks John. AWESOME. implementing creativity to my little project in previous version took me pretty long while. Now: 2minutes. AWESOME.
    One more time: thank you

  13. @Cezet: you’re welcome😉

    • Rath
    • December 6th, 2007

    I keep getting this error:

    Location: Vertices3D.as, Line 195
    Description: 1000: Ambiguous reference to Vertex3D.
    Source: vertex:Vertex3D

    Anyone

    • semiplay
    • December 7th, 2007

    I get the same error:

    Location: Vertices3D.as, Line 195
    Description: 1000: Ambiguous reference to Vertex3D.
    Source: vertex:Vertex3D

  14. Have you guys sync’d today? Ralph re-uploaded the entire code base again to fix some errors like these

    • rath
    • December 7th, 2007

    Just sync’d 5 minutes ago. Still get the same error.

  15. OYE! are you guys using FDT? Not that that’s the issue, just wondering why FlexBuilder3 isn’t throwing errors up like that for me. I’m sure you’re probably right about the error, I just want to figure out how I can see it so I can go nail the others😉

  16. Rath, Semiplay. I don’t get this error in either FDT in FlexBuilder 2 or 3. I’m trying to reproduce it, but it would be helpful if you could tell me about your setup.

    • Brian
    • December 9th, 2007

    John, Ralph, thanks for the great work. I just sync’d, and while attempting “Control > Test Movie” with EarthPhongDemo.fla, I’m also getting the same error as rath and semiplay. I’m using Flash CS3 on Windows and my classpath is \branches\GreatWhite\src.

    • Noah Aronsson-Brown
    • December 9th, 2007

    Hi John, I synced up today and am running the Great White Branch but when I test the EarthPhongDemo I get an error thrown from the TriangleMaterial.as file!??
    Here’s the error:
    1020: Method marked override must override another method.

    • Noah Aronsson-Brown
    • December 9th, 2007

    Forget it.

    It was a classpath contradiction, I didn’t realize that you can’t just set your classpath in the publish settings for a fla if you also have custom classpaths in our overall preferences. They gotta match, or not use the publish settings at all.

    Stuff works fantastic as always! Thanks.

  17. Brian, you probably still have a reference to the Papervision3D libraries (the older ones) in your classpath for flash. If not in the fla, then it’s in your Flash settings.

    • Brian
    • December 9th, 2007

    Ah, of course! I updated the Classpath in the publish settings, but the old Papervision3D Classpath was still in Flash CS3 at “Edit > Preferences > ActionScript” … Thanks!

    • Rohan Rehman
    • January 8th, 2008

    Hey John I can’t seem to access the mc used as the MovieMaterial on a Plane obj.

    Plane.material.movie gives me this error

    1119: Access of possibly undefined property movie through a reference with static type org.papervision3d.core.proto:MaterialObject3D.

    Thanks

  18. @Rohan: yeah, MaterialObject3D doesn’t have a “movie” property, so you have to cast first, then do your work:

    var mat:MovieMaterial = plane.material as MovieMaterial

    if( mat ) … do work

    if it’s NOT a MovieMaterial, mat will be null

    • stewart
    • January 11th, 2008

    how do you go about just rendering the inside of the sphere, i know with the Cube you can do Cube.ALL is there a similar way of doing this with the Sphere class ?

  19. @stewart: That, I’m not sure about, but I’m sure someone on the PV3D mail list would know right away

  20. I’m amazed by the new shading abilities!

    Currently I’m working on trying to make an object interactive, so that I can grab the object and turn it around in all axis. So far no luck. I’m using version 2.0 and am having slightly difficulties finding info about it. But as a starter, I figured this would be an easy example to play with.

    But the new way of adding interactivity to a scene and attaching events to it is making me a bit confused. I set up a scene3D object, and a Viewport3D with interactivity turned on. Next I add the interactive property to the earthMaterial. And finally, to see if it all works, I add and interactiveSceneManager to the viewport, and have it react to OBJECT_PRESS. The event handler does nothing more than return a simple trace.

    Everything seems to be working fine. I get no errors. But no trace output either. I was hoping the event would fire when I clicked the globe.

    Is this the way to add interactivity to an object? Should I use ISM?

  21. Never mind. I’m on to something. I’ll post an update.
    Sorry🙂

  22. The solution was so simple it makes me embarrassed to post this.

    I added the ‘interactive’ property to the wrong material.

    The material consists of both diffuse and bump. I added the ‘interactive’ property to the diffuse material, and not to the ShadedMaterial -which merges both of them. That’s where I should have added interactivity in the first place🙂

  23. @Thomas: Yeah what you’re doing isn’t really “easy”😉 and it can get a little confusing

    glad you figured it out!

  24. And now it gets even more confusing. All of my projects get the very same error;

    1119: Access of possibly undefined property enabled through a reference with static type Class.

  25. My comment was for some reason cut in half.

    I get this error message too:
    1061: Call to a possibly undefined method updatePosition through a reference with static type Mouse3D.

  26. And here’s the rest🙂

    And they both point at InteractiveSceneManager.as, line 259

    I erased all files and downloaded the latest ones from the SVN. But it didn’t help. I’m running out of ideas on how to solve this one.

    Sorry for the spamming

    • Tim Myers
    • January 17th, 2008

    Just wondering how lights and shaded materials can be applied to an object imported using the Collada class as opposed to a generic sphere object used in the earth example.

    This is currently the way I have it setup.

    blenderColladaXML = new XML(urlLoader.data);

    var car_material:BitmapAssetMaterial = new BitmapAssetMaterial(“car_texture”);
    var sky_material:BitmapAssetMaterial = new BitmapAssetMaterial(“sky_texture”);

    var materials = new MaterialsList( { car_texture_jpg: car_material, sky_texture_jpg: sky_material } );
    var tubObj:DisplayObject3D = new Collada(blenderColladaXML, materials, 1);
    scene.addChild(tubObj);

    How can I introduce the PointLight3D and PhongShader classes to this example. Prior to this I have just been baking the textures and exporting them as jpegs for my materials.

    any help would be greatly appreciated.

    thank you,

    tim

  27. I’m having trouble getting a MovieMaterial with interactive children working on a loaded DAE. I’m loading a dae file and trying to apply a MovieMaterial on the DAE instance. The MovieClip used for the material contains child MovieClips that I’d like to add mouse events to. The material is showing up on the DAE instance, but when i interact with the mouse i’m not receiving any events.

    I’m confused about the whole virtual mouse stuff and not sure it applies to MovieMaterials and MovieAssetMaterials. I’ve had success with adding InteractiveScene3DEvent to native DisplayObjct3D objects and the viewport.interactiveSceneManager, but not with MovieMaterials in Great White. Should I be using a native MouseEvent or a InteractiveScene3DEvent? I’ve tried both with no luck. What is the methodology for this?

    I’ve set the viewports’s interactivity property to true, as well as the interactivity property of the material.

    _material = new MovieMaterial( materialMC )
    _material.doubleSided = true;
    _material.interactive = true;
    _material.animated = true;

    var mats : MaterialsList = new MaterialsList( { Cube_mat_pn:_material } );

    _model = new DAE();
    _model.load( “myModel.dae”, mats );
    _scene.addChild( _model );

    // doesn’t work
    _model.addEventListener( InteractiveScene3DEvent.OBJECT_PRESS, _handlePress );

    // doesn’t work either
    _material.movie.mc2.addEventListener( MouseEvent.CLICK, _handleClick )

    Please let me know if you have any suggestion on this, or can briefly point me in the right direction to get this working. Much appreciated!

    -Shea

  28. I figured it out…was partly my fault. Anyway, I found the explanation at:

    http://pv3d.org/2008/01/09/interactive-cube/

    The link does not use a collada in the example, but it does explain how mouse events are received using a MovieMaterial.

  29. hey now tha we are at v 2.0 ( with support for shaders ) which 3d app will give me the quickest work flow for papervision . I mean there are lots of things that say maya and 3ds max can do that dosent get supported by papervision.

    But if I am looking at good dae export (dae morph animation export) and just a 3d app that can let me take advantage off ALL papervison3D 2.0 features with out losing me in the 3d app workflow with things that won’t get exported.

    I am using maya now but what about Blender or 3ds max? just want your opinon on that,

    Thanks.

    • Jimmy Hay
    • February 22nd, 2008

    Does anyone here know whether it’s possible to run morph animations creating in Max in Papervision 2.0?

    • Tom Macari
    • September 3rd, 2008

    Real-time 3D like Papervision3D is revolutionizing web content! I’ve just added 3D to my Flash Page builder! Just think of all the 3D Flash casual games that will now pop up.

    • Dimitrios
    • August 11th, 2009

    Link for downloading the FLA of this excellent globe rotation is brokent .Can you please publish the link .
    Thanks .

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s