Everyday 3D

Creative use of technology // A blog about 3D Flash and Actionscript by Bartek Drozdz

AS3Dmod, a modifier library for all Flash 3d engines

Meet AS3Dmod, a cross-engine 3d modifier library for Flash. Sounds cool? Yeah, I am sure it does! Just in case, however, let’s see what it does step by step.

A. Cross-engine. 3D in Flash is around here for some time now, and it resulted in quite a few engines available. Each engine has some cool features of its own, and sometimes having to choose between them can result in a headache. While AS3Dmod won’t solve this situation, it is an attempt to create some functionality that will be available across different engines.

B. Modifier library. The readers of this blog probably remember the Bend modifier I wrote for PV3D. Well, it is one of many possible modifiers. Classic 3d packages come equipped with at least a dozen of them, which include: taper, twist, noise, skew, etc. Modifiers are basically functions that can be applied to a 3d object to transform it in a certain way. They can be used separately, but when combined they become a very powerful tool. In this, they are much like filters in Photoshop.

C. Flash. Instead of explaining how modifiers work in Flash, here’s a short list of some of the possible uses: a sheet of paper, a ribbon, a waving flag, water, cloth, a tree or other plant, a butterfly, a birds wing… They could also be helpful in animating a human face, and in many other situations where animations exported from 3d editors might fall short.

Does it sound cooler now? It sounded to me when I had the idea a few days ago. As you can imagine I was not able to develop anything close to a full featured library in this short time. Nevertheless, I publish what I was able to come up so far, so that you can all see where I am heading. For the moment, here’s what’s in there:

- a framework for creating static and animated modifier stacks
- 3 basic modifiers: Noise, Bend and Perlin
- plug-ins for the most popular engines: Papervision3d, Away3d, Sandy3d and Alternativa3d
- a simple demo for each engine
- basic documentation not yet :)

Source files. The project is at Google Code. You can do a checkout from SVN or download a ZIP.

Demo. In the repository you can find 4 demo SWFs, one for each engine. It features a basic stack of 4 modifiers – Noise, Perlin and Bend x2. You can also compile the project yourself. Just follow the instructions I added in the document class code.

Notes.
1. There is no plug-in for FIVe3D – that is because this engine works in a quite different way and doesn’t use vertices which are fundamental to modifiers.
2. The Alternativa3d version works in a bit weird way. I think, it is because there’s something I don’t understand about this engine, but I will be figuring this out.

Categories: 3D, Actionscript 3, Away3D, Papervision3D, Tools

comments RSS

57 Comments

  1. That’s awesome Bartek, do you think it would work with NullDesign’s ND3D one as well?

  2. Great work Bartek! Let me know if there’s anything we (Papervision3D) can do to help you integrate better.
    We’ve been talking about a plugin enabling system amongst the core team a bit already, your system might be an ideal way to start testing it.

  3. Very nice (and quick – you know what I mean :) )

  4. Excellent work Bartek :)

    Thanks for pushing your effort to a cross-library project! Community would appreciate.

    As Ralph, is Sandy team can help you in any way, let us know.

    Cheers,
    Thomas

  5. great job.
    do you plan to implement physics aswell?

  6. [...] from Everyday Flash started writing a crossplatform package with great modifiers. You should checkt it [...]

  7. Very nice work and the four examples work fine too.
    Looking forward to experimenting with it.

  8. [...] More info here. [...]

  9. impressive! love it!

  10. wow. this is genius. Don’t kill yourself trying to keep up with every 3d flash lib out there:)

  11. Hi.

    nice nice! waiting for documentation :)

  12. impressive !!!

  13. Grzegorz

    Awesome work Bartek! Crossed-engine 3D modifier is a very helpful project which makes pv3d and other engines easy to work with! :) Outstanding! Breathtaking..!

  14. [...] Made a quick start on a sandbox for it to get ideas on how best to use it. A first usage of AS3Mod is a sandbox example to play with that can be found here. Tags » Trackback: [...]

  15. Willem Van den Broeck

    superb

  16. AS3Dmodではためく布や北斗神拳を受けた人の頭を実現。…

    AS3Dmodって言うライブラリが面白い。AS3用のクロスシミュレーション?とか言う種類のライブラリ、つまり布の動きを出してくれる。元からあったデモは布を意識したのかPlaneだったが、ち…

  17. Need this: import alternativa.types.Matrix3D; to compile the Demo. Can somebody help??

  18. @Sandro if you checkout the latest version from SVN this has been removed – it was an unnecessary import that slipped into the code. If you do not use SVN, I will try to updated the ZIP with the sources later today.

  19. Great Stuff!

    Thanx for sharing.

  20. great work!! thank you for sharing. here is my demo with Away3D.

    http://www.tres-graficos.jp/away3d/elephant102_a3d/

  21. Eric B

    This is great Bartek. The demo works fine in pv3d, but the away3d demo renders the primitive but doesn’t seem to animate or apply any of the modifiers. I then updated to the latest away3d release (701) and get the error: “1004: Namespace was not found or is not a compile-time constant.”

    They discussed the solution to this issue at http://groups.google.com/group/away3d-dev/browse_thread/thread/6629c4c20c130a87/548cf9f6cb0d05de. I guess it’s an issue with the Flash CS3 app, but not Flex.

    …of course this error may be completely unrelated to AS3Dmod and my own fault :)

  22. This is great!
    One thing though – caurina engine and Phases dont seem to mesh very well… do you have any thoughts or suggestions on the best way to implement the two?

  23. Dan

    Very impressive!

    How would you bend a corner of a plane? I’m trying to make it appear as though a piece of paper is being bent from one of the corners. It seems that you can’t rotate the bend axis. I tried combining multiple bends on the X and Y axes, but the sides are being bent completely along the length of the sides…. Any ideas?

  24. @Dan yes, I am working on it :)

  25. Really excellent package, thanks kindly for sharing :D

  26. Hello there! Thanks for as3dmod, I’m having lots of fun with it. One question though: How did you get the texture to stay so smooth during the bending? I use a bitmapMaterial with smooth:true, but the texture is still distorted in a weird way along the edge of each vertex. This is what that looks like:

    http://www.24fps.de/temp/as3dmod_problem.jpg

    Your dollar note isn’t doing that. Are you just using huge amounts of vertices or is there some other trick at work here?

    Thanks a lot in advance!
    Espy

  27. @Espy hm, I didn’t do any special tricks, and I did use a rather reasonable amount of vertices. What 3d engine did you use?

  28. Papervision 2, but I used a flattened cube so I could have different material on each side of the plane, when using an actual plane the material looks really good. I suppose that’s the problem, bending a flat cube is just not the same as bending a real plane.

    Papervision 2 doesn’t seem to support 2 different materials on a plane, how did you solve that?

    Or I could just try bending two planes separately simultaneously :D

  29. I have two planes superposed, with one sided material on each. One plane is turned 180 degrees.

  30. Works wonderfully, thanks a lot!

  31. Hello Bartek.
    Excellent work on this. It saves a lot of headaches, that’s for sure. One thing though, the “Bloat” class doesn’t have a constructor. Is this intentional? And if it is, how do you apply a bloat to an object?

  32. @David Pasieka you have to add the modifier to the stack – Bloat or any other. If you use Pv3D it would go something like this:

    var b:DisplayObject3d = some 3d object
    var m:ModifierStack = new Modifierstack(new LibraryPv3d(), b);
    m.addModifier(new Bloat);
    m.apply();

  33. that rocks :)
    looking forward for more!

  34. Hello, just a quick noob question : i can’t seem to be able to apply the ModifierStack to a DisplayObject3D that has several children ( in this case, a character with independent head, waist, legs and arms, all included inside a CharacterObject). The library accepts the primitives but throws an error( at com.as3dmod.plugins.pv3d::Pv3dMesh/setMesh()) if i try to apply it to the whole character… has anybody had a similar issue ?
    thanks

  35. ok i saw another post with the same issues, so multiple stacks it is, for now…
    thnax for a great pv3d addon !

  36. [...] potřebujete něco ohýbat modifikovat, či měnit je tu pro vás AS3Mod. Začalo to u classy Bend na ohýbání objektů a momentálně podporuje všechny 3D engins na [...]

  37. Finally I a chance to play around with the library. Check the results here:
    http://blog.reyco1.com/applying-modifiers-to-3d-objects-in-papervision3d-using-as3mod/

  38. [...] the documentation, wiki, download etc here. As far as I can see the creator is Bartek Drozdz from everydayflash – very clever actionscript [...]

  39. [...] Papervision3D instead of my usual engine choice of Away3D. It also uses a relativly new library, AS3DMod, and works with the 4 most popular engines.  Now this library is a modifier library which can do [...]

  40. [...] AS3Dmod [...]

  41. [...] AS3Dmod, a cross-engine 3d modifier library for Flash, was developed by Bartek Drozdz as a way to interact with several 3D Flash engines. [...]

  42. bebensiganteng

    dear god!! you’re brilliant

  43. wurst

    love u man ;)

  44. [...] To bend objects in Papervision3D we need a 3rd party library called AS3Dmod. [...]

  45. [...] how to deform a Collada model, here is links to resources: Using Collada Bend Modifier which uses as3dmod (see below for further [...]

  46. [...] informações você encontra em: http://code.google.com/p/as3dmod/ http://www.everydayflash.com/blog/index.php/2008/09/03/as3dmod/ Esta entrada foi escrita por Cláudio Marinho, postada em 26 de setembro de 2009 às 16:47, [...]

  47. Olly

    Hey, awesome library, I’m using the bend modifier for a playing card flip, but I’m not having much luck applying the PV3D shaders to the bend – the shading is applied to the plane as if it was still flat… Is it possible to use shaders/shadedmaterials with bending modifiers or am I out of luck?

  48. Upgrade to Flash Player 10? (using Flash 10 3D Objects and Classes)?
    Nice job…

  49. Thorsten

    Hello,

    i use the Bend method and it is really great!!! But i have one question, i use this code:

    var mstackreflection01:ModifierStack;

    mstackreflection01 = new ModifierStack(new LibraryPv3d(), plane.extra.reflection);

    var bendreflection01:Bend;

    bendreflection01 = new Bend(0, 0.5);
    bendreflection01.force = -(imagebendstrength / 100);

    mstackreflection01.addModifier(bendreflection01);
    mstackreflection01.apply();

    and it works fine. But my question is how can i change the axis. with this code i bend only the Y axis, but i want to bend the X axis. It would be really nice if someone can tell me how i can change between the axis !!!

    Thanks alot !!!

  50. kennethc

    I was typing and noticed that the previous post was about changing the axis, I too was wondering is it possible? read the doc many times, maybe I overlooked something?

  51. kennethc

    oh, use bend.switchAxes = true;

    and play with angle (-2 ~ 2) until you get it, got mine bend properly with angle of 1.5

  52. @kennethc I solved it a bit later after publishing this. You can find more info here: http://www.everydayflash.com/blog/index.php/2008/11/03/paper-simulation-as3dmod/

  53. Example Flash Modifier Library For AS3
    http://www.everydayflash.com/blog/index.php/2008/09/03/as3dmod/

  54. [...] schick. Hier gibts auch ne Lib fuer: AS3Dmod, a modifier library for all Flash 3d engines – Everyday Flash __________________ [ WHEN THE GOING GETS WEIRD THE WEIRD TURN PRO ] Download our (open-source) [...]

  55. These mods are a stroke of genius.
    If anyone wants to combine these with TweenMax AS3, you can do something like the below:
    TweenMax.to(bone, 0.7, {force:0.8, ease:Quad.easeOut});

    Tom

  56. I am using the Perlin modifier and was wondering if anyone knows how to change the speed of the animation. I want to have a higher force, but no have it move so fast. Any help would be great.

  57. I found the answer to slowing down the perlin wave, by dissecting the PerlinCarpet.as example.



  • FATC2011


  • FITC2011


  • FITC2010


  • FITC2010