Archive for the ‘RENDERING’ Category
I rarely mention stuff I have worked on here but I got a chance to use APE and AS3 on the online Plinko game at the site for the Price is Right videogame for the famed pink Plinko Board. Who doesn’t love Plinko?
I did the programming on this back when I still worked at emarketing/prizelogic.
I will be featuring a small iteration to APE with draggable particles and how I did it. In the end I didn’t use the draggable particles but they are fun (i ended up changing my collision/border particles after testing). I ended up controlling the drop location by swapping out a wheel particle after they dropped it. So that it got the famous Plinko disc bounce and roll.
Why did I use APE? Well it is the least complex physics engine. I started off with Box2dFlashAS3 and will post that one maybe as well but ended up going with APE mainly for integration it was easier that it was a less intensive codebase. Box2DFlashAS3 can scare non C++ coders with it’s style let alone AS2 coders moving to AS3.
It is slower with all the other animation going on in the site but you can also play on my server here just the Plinko part.
Can you get 10,000?
UPDATE: See comments and papervision list for revert of this change. You can now use localRotationX, localrotationY and localRotation Z instead. yaw(), pitch() and roll() are back by popular demand.
Hi List,
Sorry for this confusion, but we decided to revert back to pitch(
angle ), yaw( angle ) and roll( angle ) methods.There are three new getter / setters now though:
do3d.localRotationX
do3d.localRotationY
do3d.localRotationZSo:
pitch( 30 ) would be the same as doing localRotationX = 30;
Note that localRotationX / Y /Z are rotations relative to the
rotation as set by rotationX / Y / Z.
Also note that after do3d.lookAt() localRotationX/Y/Z will be resetted to 0Tim
ORIGINAL POST:
Papervision 3D 2.0 Alpha has been undergoing lots of changes and one you might want to know about is the object yaw, pitch and roll change. Thisis changing on how you access them but only slightly. This is good because you an read and write the values on the object not just set them. Per the papervision list from the man Tim Knip:
On many users request:
DisplayObject3D‘s methods pitch(), yaw() and roll() are now getters / setters.
Usage:
do3d.yaw = degrees;
do3d.pitch = degrees;
do3d.roll = degrees;var myYaw : Number = do3d.yaw;
This means these values are now ‘absolute’ values instead of previous
‘relative’ values as in deprecated do3d.yaw( 1 );Let me know any issues (as I’m sure there are…)
Tim
This only affects the latest and greatest revisions of papervision but is definitely a good change. It is good to make changes that make more sense without worrying about breaking changes.
[youtube]http://www.youtube.com/watch?v=YEM-XAeY4K0[/youtube]
3D models from basic video… This can be huge in all sorts of ways. For exponential growth you need to go virtual.
- This is a technology called VideoTrace from Australia
- The Siggraph paper describing VideoTrace is available here (pdf 6MB)
- Larger videos available here, with a more compressed version here.
I have been consuming all the great additions to Flash 10 this weekend and one that really jumps out after you get past the visual, text and sound features (which are spectacular btw and most of what the community was asking for). But one feature snuck by, this is the one that ByteArray (Thibault Imbert) mentions/pointed out for managing files directly within Flash.
File Reference runtime access — Bring users into the experience by letting them load files into your RIA. You can work with the content at runtime and even save it back when you are done through the browse dialog box. Files can be accessed as a byteArray or text using a convenient API in ActionScript without round-tripping to the server. You no longer have to know a server language or have access to a server to load or save files at runtime.
This greatly lowers the bar to using Flash as a photo editor, document manager, customized application experiences, marking up content and saving locally, all without the need for server side script. I am a big fan of server side technologies and develop with them but even for bettering performance this could be huge.
Scenarios where this might be useful is editing applications, note taking (download a book with your notes), editors for docs/games/3d/textures,,, the possibilities are endless really.
Flash 9 just got mainstream and production ready (flash 9 penetration) at the tail end of last year but there are so many great things in the new version that I hope it comes out very soon. Flash it turning into quite a platform.
Alternativa Platform also has updated their engine for Flash 10 already (they must have had some inside early accessibility to it) and there are great possibilities here.
It is only beta (Flash 10) but there are great market opportunities to prepare for when this launches. Keep your eye on where the puck will be, not where it is currently at. I was concerned when Adobe bought Macromedia and the future of Flash but it appears they are taking this bull by the horns.
If you are ready to play with Flash 10 here is Flex and FlashDevelop updates to help you get started.
Also here is some code posted at ByteArray from Pleh for testing the new FileReference runtime access, usage is extremely simple and rests on this
var data:ByteArray = fileRef['data']; /* FileReference Load Example By Pleh 17/05/08 */ package { import flash.display.Loader; import flash.display.Sprite; import flash.events.Event; import flash.events.MouseEvent; import flash.net.FileReference; import flash.net.FileFilter; import flash.utils.ByteArray; public class Flash10Test extends Sprite { private var fileRef:FileReference; public function Flash10Test() { fileRef = new FileReference(); fileRef.addEventListener(Event.SELECT, selectFile); fileRef.addEventListener(Event.OPEN, openFile); stage.addEventListener(MouseEvent.CLICK,stageClick); } private function selectFile(e:Event):void { fileRef['load'](); } private function openFile(e:Event):void { var data:ByteArray = fileRef['data']; var loader:Loader = new Loader(); loader.loadBytes(data); addChild(loader); } private function stageClick(e:Event):void{ fileRef.browse([new FileFilter("All Formats (*.jpg,*.gif,*.png,*.swf)", "*.jpg;*.gif;*.png;*.swf", "JPEG;jp2_;GIFF;SWFL")]); } } }
- Check out that and more at Craftymind like some other good stuff like garbage collection in AIR with actionscript 3 (as3) and serializing classes to files in AIR with AS3
- Original ‘Elastic Racetrack’ Post by Ted on Flex in 2005
This will blow you away. Found first via mrdoob (with quantum rss reading capability, before the message is concieved mrdoob is there).
Alternativa Platform, previously Alternativa Game, launched their Alternativa Platform milestone 1 and really one demo would have been enough but there are some great demos there that literally put them what appears a couple laps up on the 3d FPS style engine in Flash.
The engine is highly optimized and smooth, heavy on the processor, but using the ‘t’ key you can see some nice revealing triangle rendering. Also, playing with the field of view adds for some nice game effects. (try jumping on the fans in the half-life like room in the first demo)
Check the textures
See the Matrix
Get superpowers
From Above, Isometric
Here is what is to come from the platform:
- dynamic lighting and shadows (точечные и направленные источники света);
- bump lighting;
- parallax mapping;
- automatic UV-mapping;
- sprites, 3D-sprites;
- sprite lighting;
- texture objects;
- Global Illumination imitation;
- sprite pre-render system (phases render on server using uploaded 3D-models);
- animation system (including inverse kinematics);
- 3D-objects interactivity;
- physics simulation.
Congrats to the Russian based Alternativa Platform, the world is watching.
Jono is giving SWFZ to science and the open source devices.
The SWFZ engine is one Flash 3D engine that took a different approach. It is a bit early in its technique used but the author at custom:media Jono has decided to float the source code out there in ghost mode (no active development but not dead). It is just ready to branch and others to run with it. He is floating the source but I think in 1-2 years this will be the preferred method if processors and multicore parallel usage is optimized. We shall see.
The implementation method and difference with SWFZ engine in Flash for 3d is that is is a pixel based renderer or scanline. It is based on a really fun game engine called Irrlicht which has been pretty active for the last few years but is a C++ DirectX and OpenGL engine. Since SWFZ has to run in Flash and it is a pixel renderer/scanline it has some limitations currently in Flash. Games and renders have to be fast to pull this off and Flash is limited by the software renderer but as computers get multiple processors and flash player gets better at this then this will be a viable option (it is the same thing that limits Canvas based renderers right now). One main problem with this is you can’t go too full screen the biggest sizes that perform well are smaller windows 320×240 etc. But if the processors can handle it it is actually more efficient when it removes overlap, extra triangle drawing and painters algorithm like problems dont’ pop up (triangle overlap when on same plane). This method draws pixel by pixel but fast enough flash engines like Papervision, Sandy3D and Away3D draw overlaps due to the drawing technique, back to front.
But SWFZ still manages to pull off some amazing feats such as these demos
Jono has put some great classes into SWFZ engine such as bsp parsers, quake md2 parsers, animated mesh, and lots of great examples in porting C++ Irrlicht to AS3. This was a very early example of how AS3 was fun for programmers to port stuff from C or C++ into Flash. AS3 is just fun. Also be sure to check the site for more samples like an FPS game, some basic ai etc.
Jono has been working on 3d in Flash for a while and actually this message is what shows the difference betweeen this approach and other flash engines the way Papervision, Sandy and Away3D (pv3d derivative) make 3d in flash fast enough (Painter’s Algorithm and drawing skewed movieclips and textures.
Demos
- Post on Open Sourcing of Code
- Post on Some Unfinished Work to Build On
- Demo Quake Prototype
- Demo Terrain
- Download Source SWFZ
- Download Source Dependency (FileSystem)
More about the Engine Some Notes
The SWFZ engine.
Overview:
SWFZ engine is the result of four years of me messing with 3D in Flash.
I was a complete newbie to 3D, so a lot of learning has happened to get to here.
If you’re interested in 3D engines check out the resource links at the bottom of the page:
The Demo:
Model
- .md2 format from ID’s Quake2.
- Uses frame based animation
- Textured with jpeg
- No lighting, No Gouraud Shading, just plain texture
Skybox
- Textures are just jpegs.
Boxes
- Rendering – Textured Gouraud , Textured Gouraud with Alpha, Textured Gouraud with Quick Alpha, Gouraud Shaded, and the large box is just Textured.
- Star Texture – Targa (.tga) file format.
AS3 classes
- 171 classes and interfaces
Scene
- No lighting
- No collision detection
SWFZ engine technology:
The demo only shows a small part of the capabilities of the engine. In the coming weeks I will get www.custommedia.co.nz up and running and start to post more info then.
Currently implement stuff:
New file formats supported
- .tga – Targa Image
- .bmp – Bitmap Image
- .3ds – 3D Studio Max
- .bsp – Quake3 levels
- .md2 – Quake2 models
- .obj – Wavefront 3d object (static)
- .zip – Read from a zip archive (all in Flash, no server side scripts)
3D Rendering
- mipmaps
- perspective correct texturing + affine texturing
- Flat shading
- Gouraud
- Textured Gouraud
- Textured Flat
- Textured Two Layers
- Gouraud Alpha
- Textured Flat Alpha
- Textured Gouraud Alpha
3D Scene
- Billboards
- Parent, Child scene nodes
- OctTree
- Skybox
- Static Meshes
- Animated Meshes
- Basic collision detection
- Scene node animators
If any code is useful to you maybe drop him a donation or what would be nice if this was all setup at google code and used to be integrated into other engines. Irrlicht ports are fun and there is a future in this method when processors catch up I think.
Good news, I meant to post this a few days ago last weekend Tim Knip added 3DS parsing support to Papervision3D. Here is the thread with the quick howto.
Thread in nabble
Added a simple 3DS parser to the Great White trunk.
=> org.papervision3d.objects.parsers.Max3DS
…USAGE:
// where to find textures var textureDir:String = "./images/"; // use a trailing slash! // optional materialsList var materials:MaterialsList = new MaterialsList(); // the 3DS file var fileName:String = "[path-to-3ds-file]"; // load it! _3ds.load(fileName, materials, textureDir); // add to scene scene.addChild(_3ds);
Also, one other golden nugget is Den Ivanov’s newest demo with Papervision portals! This is a very smooth demo, be sure to enter into the portals to see the seasons change.
Also here is a non papervision 3ds parser.
a virtual machine genius (maker of MTASC compiler, Neko and haXe (haXe compiles to target flash 6-9 but really only flash 9 is used anymore unless you are making banners)) released the Physaxe 2D Physics kit for haXe today.
It is heavily based on Glaze (demos) and Box2D which the Motor2, Glaze and Box2DFlashAS3 physics kits are all based on. Box2D is a great C++ 2D physics engine, it is simple which lended itself to being ported to AS3 quite easily. It is also a testament to AS3 that C++ kits are being ported into the language, not once, but many times. Also C ports like Chipmunk and other signs point to == AS3 is of fun.
Physaxe is quite amazing you must see the demos (very similar to Glade demos), it will get the inspirational wheels turning in your idea machines.
2D Physics in Flash and AS3 are extremely hot and can be used for many, many things from game development to promotions to simulations to user interface or visualizations and even modeling natural systems. It is nice to have a port of Box2D and similar to glade capabilities with Chipmunk like Glade has.
A game and physics engine for Flash including:
- Rigid Body Dynamics
- Scene management
- Line of sight
- User Input
- Scrolling
- AI
Core parts of the physics solver and collision system are based on the C physics engine Chipmunk
Notes about Physaxe:
Physaxe is a 2D Rigid Body Library written in haXe. It’s been highly optimized for the Flash 9 Player, with the best optimizations available.
Physaxe is based on several existing physics engines, mainly :
- Box2D, the reference open source physics engine
- Glaze, an AS3 engine which is a port of Chipmunk, itself based on Box2D
Physaxe features are :
- rigid body consisting in several shapes
- shapes supported are circles, segments (with rounded edges) and arbitrary convex polygons
- customizable broadphase (currently bruteforce and y-sorted list are available)
- island resolution and sleeping (allow ~0 CPU to be spent when groups are sleeping)
- constraint solver based on Box2D sequential impulses
- customizable body properties, such as linear/angular friction and maximized motion
Updated list of physics engines are like this:
AS3 3D Physics Engines (Open Source)
AS3 2D Physics Engines (Open Source)
haXe 2D Physics Engines
Get your game on! It is best to get them out early and often. I need to take my own advice.
TweenMax (Speed Test) has been released that adds a main feature missing from GreenSock’s offerings in tween animation libraries and kits over Tweener. That is the bezier curve tween. Tweener is very popular for use in PV3d and AS3 due to the bezier curve and Zeh’s great example that is really the base of a possible 3d editor. TweenMax now adds this and bezier tween capability for the GreenSock animation libraries.
Tweener and TweenLite have become the micro animation kits as well as micro kits you can make with Go base kits. TweenLite, TweenFilterLite and TweenMax divided up into different kits allows it to be embedded for banners or small assets easier if you don’t need the filters or other advanced tweens (this comes into play heavily with large games and asset collections when the compiled SWF each need the library). Tweener packs all features into one kit for simplicity. GreenSock kits are divided up for need. The comparison together is about the same but for basic tweens TweenLite is only 2k.
Performance is one area that the kits from GreenSock have really shined and since the addition of the speed tests and benchmarks it has become a great focus on showing how the open source kits are much better than bloated included animation calls in Flash and Flex defaults. I think all the kits have niches that they fit and Tweener and TweenLite are just very simple to use which adds alot to an animation kit success.
List of Animation Kits for AS3 (some for AS2 as well)
If you are using the Flex of Flash default animation classes, I am sorry…

















