Generating Shapes with Animatable Curves

  / by Toni

After seeing promising animation tests by Lee (video, blend) with curves in Blender last week, I started experimenting with them in BPython. The challenge is to create large amounts of them in a controlled manner, and have them well manipulable and animatable after creation, too. Now I have a first version put together for all you to see and comment, and hopefully start developing further too! It is not really useful yet, and the current visual output is nowhere near Orange standards, but the code proves the basic concept and brought up issues that had to be fixed (in the API code).


Initial phase.
Many curves generated. Some curves deleted.

Here’s how it works: when started, a so-called ‘guiding curve’ must be assigned first. It should be a Bezier curve, and its shape is then used as the base for the newly created curves. After assigning a selected curve to be the guiding curve with the GUI button, a slider can be used to set the amount of generated curves around the ‘guide’. In this first test the generation is fixed to proceed along the z-axis (which is up/down in the front view), but the idea is to use another shape (called ‘target’) to define the area to be filled / shape to be generated. That’s the first major todo point for version 0.2, animation features coming as second.

The cool thing is that the generated curves can not only be generated, by also deleted by the script. And not only during the run, but also after restarts. This is different from otherwise similar scripts, like the L-System generator and Beast (I must still look more into makehuman, which probably handles this well too). Also, the generated curves can be e.g. deleted in the normal Blender UI, and the script/manipulator notes it. This is a central challenge: to allow both automated and manual editing of the same things, so that things keep in sync and tools can be as powerful as ever. I’m currently using parenting to get the info in the script about which curves are to be manipulated, so if a modeller wants to make sure that some generated and perhaps afterwards modified, curve can’t be deleted by this tool, that can be ensured by clearing parenting. But then the script can’t control that curve for animation anymore.. so there sure are interesting challenged down this road still!

Yet a bit deeper into technical details and issues encountered there: we are using Bezier curves, because like the way they are controlled with the handles. So on the scripting side, I had to learn about the unpublished and partly unfinished BezTriple BPython module. In fact, most of the time in this work so far has gone into figuring out the ways to use that part of the API, and fixing bugs in it. There’s a memory leak and some inconveniences in the latest release version 2.37a, but I’m happy to report that the current cvs works without problems now. Thanks a lot to the Python Team guys for the great support in sorting those problems out! For future developments, I already added a way to add the tapering curve to the API, and will probably need to look into manipulating the modifier stack too. So am afraid that the development of the actual script, and the visual quality of it’s output, will not develope as quickly as it could with having perfect tools ready at hand, but of course it’s great to get to enhance the API and work with Blender itself — it’s the idea of the project, after all.

Finally, I’d like to invite anyone interested to suggest ideas, and the fellow scriptwriters to take a look at the approach. Nothing about this is set in stone — it’s just a first test and an example of one possibility. Especially I’m hoping to get views on how existing tools, like Beast, relate to this. Perhaps these features (curve support, deleting / regenerating / manipulating after restarts, animation, ..) could be even merged there, or we could have some new joint project that takes elements from both (and perhaps e.g. from the lsystem generator too). I’d be ready to take this further in a public CVS that we can set-up on the Blender projects website if there’s interest. And of course can use the Blenderdev wiki to form ideas etc. Also, I just created an irc channel called #blenderpython on freenode as a place to coordinate tool development and will hang out there.

Oh and to try this yourself, the source is curvepulator_01.py and a test blend is there too. It should work to some extent on 2.37a (try removing the __future__ import as it does not seem to work there), but requires the extra ScriptUI module with my modifications, as discussed on the ScriptUI Elysiun thread. To get the new fixes in the BezTriple module, and coming animation features using tapering etc., a current version from CVS is needed at this point (we’ll see if ScriptUI ends up there or not).

~Toni

« | »




12 Responses to “Generating Shapes with Animatable Curves”

  1. Jonathan Merritt said on 16 Sep, 2005:

    How about a CVS repository for “Orange Python Scripts”?

    It’s going to get tricky for people to keep up to date if there are custom versions of things floating around, especially after community contributions. Keeping all Orange-related scripts in CVS or SVN might help considerably.

    What do people think?

    This is just awesome work! :-) Somebody should play with exporting curves like these for rendering in Aqsis. ;-)

    Jonathan Merritt.


  2. Toni said on 16 Sep, 2005:

    Yes, that’s why I’m proposing having a repository for this too. But it may be that it does not have to be Orange specific, but more about what the specific tool is..

    BTW Blender MakeHair from the Makehuman folks uses Aqsis to render, http://www.dedalo-3d.com/index.php?filename=SXCOL/makehair/abstract.html.

    ~Toni


  3. Brian said on 16 Sep, 2005:

    Yeah. Thats a disappointment. (The MakeHair) I prefer to keep everything rendering via the internal renderer so there isn’t issues with compatibility of different features/effects.


  4. Davide said on 16 Sep, 2005:

    All of this looks very great, and various great tips for newbie/medium users like me :D; I hope we will post more about the script/ concept, but I understand that some details have to remain unknown to the public so the movie can have full impact when it get out of the box. Continue that way, this project means a lot for several amators animatores that will now have a prof-of-concept that is possible to make medium/high qualitie movies, only using open-source and free software. I can’t wait to see the teaser :D


  5. JoOngle said on 16 Sep, 2005:

    Yeah…

    It would have been better if the MakeHair was availiable to Blender’s renderer or at least Yafray that has been integrated properly. Using Aqsis as it is now…is a “hassle” to say the least + nothing is close to even useable at the moment, but of course…I’ll root for Aqsis all the way :)


  6. Wim said on 19 Sep, 2005:

    “It would have been better if the MakeHair was availiable to Blender’s renderer or at least Yafray that has been integrated properly…. ”

    True, but it is also only usable for still pictures as far as I read information about it.

    I have been struggling to make some descent looking hair… and it would be great to have a good hair-system built-in in Blender.


  7. Vassilios Boucer said on 19 Sep, 2005:

    Yes,i also agree with Wim!
    ….and it would be great to have a good hair-system built-in in Blender.

    Thanks for all Files!

    Vassilios Boucer


  8. Joel Leineweber said on 22 Sep, 2005:

    This is awesome stuff and I’m glad it’s prompting fixes and completions in the BPython API!

    I haven’t been able to watch any of the .avi files in your posts … quicktime keeps asking for software from the Apple site. Which plugin is required to view these videos? (I’m on OS 10.4.2, Quicktime 7) Is anyone else having this problem?


  9. Orange said on 22 Sep, 2005:

    Hi,

    I think it might be in DivX format. Try http://www.divx.com/divx/mac/, hopefully you can find a place to download it there. Cheers!


  10. Toni said on 4 Dec, 2005:

    just a note:

    22:39 oh gee i might use this to improve my stoopid variate() function in curvepulator!

    rvs(self, *args, **kwds) Random variates of given type. The shape parameter(s) for the distribution (see docstring of the instance object for more information)

    **kwds:
    size – number of random variates
    loc – location parameter
    scale – scale parameter

    http://www.scipy.org/documentation/apidocs/scipy/scipy.stats.distributions.html#rv_continuous-rvs


  11. leafw said on 5 Dec, 2005:

    Toni,

    I didn’t know of your project and I’m about to duplicate it somehow. I have implemented an algorithm to generate any given number of curves between any two pair of curves, so that one can create 3D meshes out of a series of bezier curves (no matter how many control points each bezier curve has). The code is GPL, and available at this website: http://www.pensament.net/java/CurveMorphing.html

    I cannot implement the editing of the mesh by pulling the bezier curves because of the Curve module being in such a dramatic state in 2.37a (seg faults on me), but I’m going to do so as soon as 2.40 becomes stable.

    The strategy of keeping the curves parented to the mesh is also my approach. But I need to add further tools, for example the adjusting of any of the bezier curves that define the mesh by simply by making it be a weighted average of itself and its neighbor curves.


  12. Sugar ZX said on 25 Mar, 2006:

    Yes, that should be problematic “..So am afraid that the development of the actual script, and the visual quality of it’s output, will not develope as quickly as it could with having perfect tools ready at hand, but of course it’s great to get to enhance the API and work with Blender itself — it’s the idea of the project, after all…”


ok