A Papervision 2.0 alpha example
I drew up this example a few weeks ago to learn about the new features in Papervision 2.0 alpha. If you’re thinking of looking into the new version, then hopefully you’ll find the supplied source code below of some use. I used the code from this screencast on unitzeroone.com as a starting point.
The source code has example usage of the following things…
- Setting up and rendering a simple 3d scene
- Materials that take a light source, found in the org.papervision3d.materials.shadematerials package (GouraudMaterial, PhongMaterial, CellMaterial, FlatShadeMaterial, EnvMapMaterial). And CompositeMaterial, too, which is pretty useful as well.
- Shaders (EnvMapShader)
- Multiple viewports (used here to create the reflection on the floor)
- Simple user interaction using InteractiveSceneManager (clicking on a ball makes it bounce)
I wanted to throw all the example materials into the scene at the same time in order to compare their appearance, etc., so you may find the demo to run quite slowly…
Please note this source targeted the Papervision 2.0 alpha, and won’t compile on more up-to-date versions without making a few adjustments…
Licensed under a Creative Commons Attribution 3.0 License.

January 8th, 2008 at 5:22 am
Demo is running smoothly :)
Thanks for the source !
January 8th, 2008 at 2:46 pm
very cool lee!
thanx for posting the source!
the only new feature i see missing is culling.
you could zoom the cam and show a ploy count
so ppl can see when an object is off screen pv3d
dounst wait resources rendering unnecessary stuff…
just a thought.
thanx again!
January 22nd, 2008 at 9:29 am
Hi Lee,
cool Demo, but this line of code doesnt function
// Make sphere bounce…
Tweener.addTween(e.target, { y:100, bezier:{ y:600 }, time:3, transition:”easeoutbounce”} );
There will be an error dropped that Sphere has no _bezier property – what is wrong
January 30th, 2008 at 11:00 am
I argued, Thornfield will, probably, be a good way from the town. satellite street map views A new servitude. There is something in that, I soliloquised
April 30th, 2008 at 9:43 am
Hello, what if i have a texturized plane and i wanna get the pixel color of a given 3d coordinates ? Just dunno enough about matrix and inverseMatrix, any hints ?
thank u for help, hierro.
May 18th, 2008 at 8:18 am
thanks
September 8th, 2008 at 1:59 pm
looks like the newest version of great white (pv2 beta) doesnt have “FreeCamera3D” but you can use find and replace to change the 3 instances to “Camera3D” and get the same results.
December 17th, 2008 at 9:53 am
I have a question about ShadedMaterial, why is there some black lines on the top of the sphere?
Can we remove it, how?
January 9th, 2009 at 10:37 am
thanks for sharing the code…i’m a java programmer and
i definitively have to take a look of that. i saw you imported a lot
of cool objets i’ve never used or seen in my life
March 16th, 2009 at 6:10 pm
thanks for the ideas, im beginning to learn codes
April 13th, 2009 at 7:24 am
Hi,
I have been experimenting with this example and noticed something weird. The spheres with materials attached that are based on EnvMapMaterial have their lighting / material mirrored on their surface (as if there is a light source opposite the actual light source). The Flat- and Gouraud spheres behave as expected, but materials based on EnvMapMaterial show this fenomenon.
Papervisions’ EnvMapMaterial has a property .backenvmap. This property is utilized in EnvMapMaterial.drawTriangle but the implementation seems incorrect so that the backenvmap is actually never used???
The method seems to choose between the map to draw from (lightMap / backenvmap) based on the angle of the face with the light source. For angles > 90 or 0){
useMap = _lightMap;
}else{
useMap = backenvmap;
}
graphics.beginBitmapFill( _lightMap, transformMatrix, false, false);
[/code]
Would this be an explanation for the fact that materials based on EnvMapMaterial show this 'undesired', at least by me, side effect? As Im kind of a novice to PV I cant image that this wouldnt have been noticed yet...
Coudl someone confirm, or deny and explain?
Chrs
April 16th, 2009 at 7:45 pm
Having only played with EnvMapMaterial superficially, I’d also like some elaboration on this. :D
Lee
September 3rd, 2009 at 5:42 pm
hmm, when I publish, I only see a gray screen,
any ideas?
thx
!m
September 3rd, 2009 at 7:20 pm
Thanks for thw source!
September 29th, 2009 at 8:01 am
The source is a 404 could you please publish it again?
September 29th, 2009 at 9:39 am
@Mateusz, Thanks for letting me know. I’ve updated the link. -Lee