The Magic Carpet
>> Looking for the source code? Just go the next post here<<
I managed to have some time to put together the simulation i was talking about last week: roughly based on a “Flade” (now APE) demo of that time, it makes use of APE for the physics and Papervision3D for the rasterization process.
Actually, using PV3D for merely rasterizing polygons its obviously an ugly solution if you, like me, don’t need all the scene management and just need to stretch bitmaps around: the real reason behind that choice is simply i was curious to see (1) how PV3D performed in a similar situation and (2) how to be able to bind APE and PV3D together.
Anyway, just modelling and simulating the carpet wasn’t enough: the motion were great and performing quite well, but it was lacking completely the sense and taste of realism one would expect from such a scene and the particular type of motion one can interact with.
I started by adding a (really) fake shadow that i’m too lazy to change and, since then, i liked the idea and adding a reflection was the next logical step for that context: it was still lacking some motion “feeling” so i also tried to mimic a directional blur simply by programmatically reducing the amount of blur on the slowest x-y direction.
I stopped experimenting with the blur thing, but i think it could be somewhat enhanced: i was thinking about a 3×3 / 5×5 kernel convolution filter in order to enhance angular motion, but i really have no time to try this out… do you know if this has been already attempted before?
Anyway, beside having a carpet pinned in a void chamber, although funny and nice to interact with, the scene lighting and colors weren’t so exciting, so i decided to play with bitmaps and filters with realtime compositing and post-processing in mind, eventually ending up with a bloom-like filter that seems to be able to enhance the imagery quite well.
The UI will permit to adjust the values of the simulation, output, effects and post-processing: since the computations can be really heavy and stopping the VM from working, an automatic adjustment of the physics integration timestep is enabled by default and it will look green/red when working for you, meaning respectively it’s raising/lowering the timestep.
During the development i’ve tried different versions of the Flash Player and here are the results:
- 9.0.45 – 9.0.47: on my machine i got something like 50fps with the default settings, some glitches can occur when changing the “Simulation” tab’s settings and i rarely got a Flash Player crash;
- 9.0.60.120: i got 60/65fps with default settings, no glitches occurs while modifying “Simulation” values and no crashes directly correlated with this have occured. There is a really odd behavior of the Flash Player btw, where a vertical band on the left can be seen when playing with the carpet smashing it from right to left: the vertical band’s width seems to be related to the position of the carpet but i’m still investigating that; playing with the carpet on the vertical band DOES hang the Flash Player. Hope to be able to tell more info on that: in the meantime, turning off the post-processing will prevent the problems from happening.
As a final note, i highly recommend to install the latest beta of the Flash Player since the performance really got a boost.
Let me know how it works for you: also, i plan to release the source code for both the demo and my modified version of APE (to let it to work with a fixed timestep expressed in Hz) so i’ll update these pages pretty soon.
| Print article | This entry was posted by Manuel on August 10, 2007 at 19:26, and is filed under as3. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |
- Magic Carpet « Papervision3D
- Fábio Pedrosa » Magic Carpet
- links for 2007-08-23 « Simply… A User
- top paper vision demos – Graphic Design Forum and Web Design Forum
- The Magic Carpet » Darren Richardson
- The Magic Carpet
- listtoday
- blog.nm-graefen » Blog Archive » Manuel Bua – The Magic Carpet
- Home of a Risktaker | Hikmat b. Iskandar – Malaysian Web Designer. Software Developer. » Holy %@#$, this is Flash!
- blog.ad2.com » Blog Archive » Magic Carpet Ride
- Compiz-like wobbling windows in AS3 — Manuel’s Coding Blog
- Interface Design » Manuel Bua’s Magic Carpet
- sonson
- Le Tapis magique – Noevia.com

about 2 years ago
Man, this is really amazing!!! Respect!
about 2 years ago
Totally owsome! Man, you rule!
about 2 years ago
Amazing only starts to cover it…this freaking ROCKS \m/
about 2 years ago
Hey big thanks for your feedback!
about 2 years ago
Brilliant work. Even the shadows/blurs/reflections look gorgeous. And the source code to boot! Excellent contribution.
about 2 years ago
Its magic! Well done, didn’t see a lot using APE (yet) with PaperVision 3D.
about 2 years ago
god…, don’t stop doing this!
about 2 years ago
Great work!!! This is a great idea! I especially liked the fact that the simulation is “careful” not to crash flash and auto adjusts. Once again, great work, keep it up!
about 2 years ago
great stuff
about 2 years ago
I’m incredibly impressed by the performance. The postprocessing is what really makes this demo shine– I’m curious about what you used for the bloom effect. That, in combination with the motion blur, really takes it to the next level. I’ve played around with APE and found the API pleasantly simple yet powerful. Still have yet to get in depth with PV3D though!
Kudos^100 to you!! And I must say, kudos to the new AVM developers, the performance boosts are some excellent work.
about 2 years ago
This is really totally awsome! Adobe should have a talk with you!
about 2 years ago
alec cove not alex cove
about 2 years ago
What I don’t get…what I’m trying to understand from the code, having not ever used APE…is how you’re deriving the z coordinates. Making a point mesh was a great call for fabrics, etc…. it’s a really fantastic demo. But how are you getting the z for the points, or are they just falling through z to zero at a static rate of acceleration irregardless of their adjoining points?
about 2 years ago
Beh, complimenti per la naturalezza del movimento e per la resa complessiva!
about 2 years ago
All my respect ! Thanks for sharing it!
about 2 years ago
damn man. good work.
about 2 years ago
You are an hero! Brao vecio
about 2 years ago
excellent !
good work.
about 2 years ago
this is really excellent!
about 2 years ago
I never thought this could be done with Flash. At first, I hated what Adobe did with Actionscript, but maybe it’s replacing Java once and for all
about 2 years ago
This is amazing! Great work!!!
about 2 years ago
amazing, respect.
about 2 years ago
blown away!
about 2 years ago
really cool!
but why doesn’t thi carpet roll up when spinnin’ or i don get smth ?
anyway this’s awesome plz don’t stop )
about 2 years ago
how do you open thsi file what is a project file and ACTIONSCRIPTPROPERTIES File
about 2 years ago
where’s source code?thanks
about 2 years ago
Nice work. Keep going same way.
about 2 years ago
Man, this is just beautiful. I’m stunned. Really. You really got me enthusiastic to start working on 3d physics in flash. I haven’t done a lot of work with AS3 (my company wants me to work in AS2 for now), but I’m definitely going to dive deep into it now. Are you planning on releasing the source code anytime? It’s gonna be a really big help and inspiration for a lot of people I’m sure. Great work again. Compliments.
about 2 years ago
@idefix and @ryan
I’m happy you’ll start digging into physics and Flash, and sure you can take a look to the source code at http://manuel.bit-fire.com/2007/08/11/carpets-sources/
about 2 years ago
Finally, a papervision3D demo that is not disappointing! Of course it’s the (APE) physics that make this impressive. And after spending several hours perusing the web for Papervision3D demos this is the first one I’ve come across that truly impresses me! Great job!
about 2 years ago
wow……………………………..
about 2 years ago
that is very, very good.
i stublemed onto this looking for carpet related blog posts.
my friend matt askey had a very different experience with the carpet on the floor of my kitchen this weekend.
That has very little to do with you post though so i appologise, but again the flash & Physics is impressive to say the least.
Jim
about 2 years ago
nice effect
about 2 years ago
Thanx, very inspiring!
Manuel, Xero. I tried to porting Magic Carpet on GreatWhite, it working but not right, because i got into muddle in new pv3d20′s center coordinates point, i hardcoded it:
in Simulator.as > CenterMesh():
var x: int = ( Configuration.OUTPUT_WIDTH – aWidth ) / 2. – Configuration.OUTPUT_WIDTH/2;
var y: int = 50 – Configuration.OUTPUT_HEIGHT/2;
in ParticlePicker.as > tick():
pickedParticle.px = Resources.theStage.mouseX – Configuration.OUTPUT_WIDTH/2;
pickedParticle.py = Resources.theStage.mouseY – Configuration.OUTPUT_HEIGHT/2;
Where is else need to fix coordinate point?
http://exey.ru/MagicCarpet_pv3d20.zip
about 2 years ago
Nice work
about 1 year ago
awesome effect ,i like it
about 1 year ago
Great effect, where did you learned this dude
about 1 year ago
Wow, I just love this, and I cannot imagine the amount of work! I just got started with Papervision 3D. I am interested in getting something liek this on my site. if you go to http://www.blindmanstudio.com you will see my site’s logo/avatar ont he top. he is a collada model. There is a blindfold on him with a piece hanging off the back. I was wondering would it be at all possible to get a cloth sim going on that piece? and keep it attached to him?
if you could please give me some feedback on the possibility of this, I will be looking at the source code to try and figure it out int he meantime…
if you are willing to help, my contact info is on my site!
and thanks again for giving the source on this, SO much I can learn from it!
about 1 year ago
Great work.
about 1 year ago
Thanks for the information. It would be nice if more people commented on this topic. It’s not too confusing if you read and understand then please teach what your learning..