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,0×303030,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!

52 Responses to “Papervision3D 2.0 Released – Great White”

  1. Erik Lembke Says:

    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. John Grden Says:

    Yeah I figured you’d be excited about viewports Erik ;) It’ll make what you’re producing much easier ;)

  3. Flexified, Simple Papervision3D Hello World « lukesh +interactive Says:

    [...] 5, 2007 · No Comments This is a flexified, simplified version of John Grden’s earth demo. Create a new Flexproject called “GreatWhiteExperiment1″, add the GreatWhite source path, and paste the code:   [...]

  4. Matthew Says:

    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.

  5. JR Fabito Says:

    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”.

  6. Oliver Says:

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

    Any ideas ?

  7. Josh Says:

    Hey, nice to see that it doesn’t seem to eat up as much of my CPU! :)

  8. John Grden Says:

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

    Thanks for the heads up though!

  9. Eric-Paul Says:

    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.

  10. Oliver Says:

    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 ;-)

  11. Jeremy Chone Says:

    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.

  12. John Grden Says:

    @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.

  13. Papervision3D 2.0 - Great White - is out | zedia flash blog Says:

    [...] It’s funny because just last weak I was trying it out, I started with version 1.5, then I went to version 1.7. Two days later I was reading the forums and I kept reading about the Phunky Branch, so I tried it, it was version 1.9. Now just one week later version 2.0 is out, I guess I’ll have to switch again. It seems like a lot as changed in the Great White branch so I suggest reading this articles by John Grden about how to upgrade current papervision3d projects. [...]

  14. Neven Says:

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

  15. Cezet Says:

    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?

  16. FlashBookmarks Says:

    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” ?

  17. John Grden Says:

    @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’

  18. John Grden Says:

    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.

  19. Cezet Says:

    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

  20. John Grden Says:

    @Cezet: you’re welcome ;)

  21. Rath Says:

    I keep getting this error:

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

    Anyone

  22. semiplay Says:

    I get the same error:

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

  23. John Grden Says:

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

  24. rath Says:

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

  25. John Grden Says:

    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 ;)

  26. Ralph Says:

    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.

  27. JMParsons » Blog Archive » Papervision 3D 2.0 Alpha "Great White" Released Says:

    [...] The documentation has yet to be updated on Papervision 3D’s documentation site with the new classes available from the new release, but there is a great example on RockonFlash.com of how a scene can be constructed and can clarify the basics of “Great White” found here – RockonFlash.com Papervision 3D 2.0 Great White article. [...]

  28. Brian Says:

    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.

  29. Noah Aronsson-Brown Says:

    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.

  30. Noah Aronsson-Brown Says:

    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.

  31. Ralph Says:

    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.

  32. Brian Says:

    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!

  33. Interactive scene with Papervision3D (Great White) | zedia flash blog Says:

    [...] I updated my previous experimentations with papervision3D to version 2.0 (Great White). I can say that it wasn’t too hard thanks to this John Grden article.  But is article doesn’t explain everything. A lot of things have moved since the phunky branch; as an example, Planes are now in the org.papervision3d.objects.primitives package. Once you adjusted all the package you previously used so that they can now compile, you can start playing with the new toys. I didn’t try anything fancy; I just wanted to make my materials interactive. It actually was easier than with the previous version even if I had less documentation. I didn’t quite get how to use the Interactive Scene Manager in the previous version. [...]

  34. blog d’un développeur multimédia » Blog Archive » papervision3D - v2.0, prenez en ombrage Says:

    [...] J’ai repris, un exemple d’un des créateurs du moteur. Je me suis contenté de le porter sous Flex 2 (utilisation des commandes Embed) et de le traduire en français. [...]

  35. Rohan Rehman Says:

    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

  36. John Grden Says:

    @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

  37. stewart Says:

    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 ?

  38. John Grden Says:

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

  39. Thomas Viktil Says:

    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?

  40. Thomas Viktil Says:

    Never mind. I’m on to something. I’ll post an update.
    Sorry :)

  41. Thomas Viktil Says:

    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 :)

  42. John Grden Says:

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

    glad you figured it out!

  43. Thomas Viktil Says:

    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.

  44. Thomas Viktil Says:

    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.

  45. Thomas Viktil Says:

    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

  46. Tim Myers Says:

    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

  47. Shea Says:

    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

  48. Shea Says:

    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.

  49. Rohan Rehman Says:

    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.

  50. Jimmy Hay Says:

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

  51. Tom Macari Says:

    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.

  52. Dimitrios Says:

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


Leave a Reply