picture home | art | events | music | rack extensions | downloads | pixel blog

omino pixel blog

pixels, motion, and scripting
david van brink // Wed 2011.02.16 09:19 // {after effects}

AE & Python

I was going to provide another example or two of Python scripting, today, but was sidetracked by a little bit of historical research on Python in After Effects. The examples will wait a little longer…

Useful Things

Yes, indeed, everything old is new again. Just about the time I started using After Effects, I had heard of “Useful Things”, but didn’t really know what it was. Turns out it was… Python Scripting for After Effects! It appears to have been quite well-regarded in the AE community, too. Alas, for whatever reasons, that product seems to have faded, been reabsorbed in the various business permutations that are a fact of life.

Omino Python for After Effects, by coincidence and parallel evolution, seems to resemble that fine product in some aspiring ways.

Grant Munsey

Going back even a tiny bit further, to 2001, we find that Adobe computer scientist Grant Munsey created open source Python bindings for Photoshop and After Effects, as well!

Reading about him, he was a great proponent of open source development, and was a driving force for establishing http://opensource.adobe.com/.

He passed away in 2005; I did not know him. But reading about his long illness, I was touched by this part of his wife’s account:

We’ve been using the mouth stick. It’s a 16-inch rod with a rubber tip on one end and on the other end a U-shaped plastic thing he bites on. He can then trace patterns and point to letters on the letter board — very slowly. I asked him what UNIX command you’d use for getting regular expressions from a text file, and he spelled “GREP”.

And forgive me if I find in this a dark justification for the oft-maligned brevity of UNIX commands.

1 comments
Rich Young // Sun 2011.02.27 17:395:39 pm

I think Grant also did an early plug-in set, Cognicon TILT. Later sold to Digieffects, TILT was an 3D system that did 3D displacement and imported 3D models using Quickdraw 3D from Apple.

oh, i dont know. what do you think?


david van brink // Sun 2011.02.6 09:22 // {after effects}

AE: Omino Python

For immediate download: Omino Python Plug-in for After Effects.

This plug-in lets you write a script in Python and then run it on every frame. The script can do drawing, access other layers, and so forth. Because sometimes, you just need to write code to get the job done. Omino Python gives you a straightforward way to provide drawing code directly in your After Effects work flow.

This isn’t for everyone; but if you have a little bit of scripting experience, Omino Python should be very easy for you to pick up.

Mac OS X on AECS5 only, for now…

Here’s a little demo.

Here’s another youtube demo, too.

The download includes plenty of documentation, or you can read it right now.

I’ll be posting some tips and examples — there are so many possibilities opened up! — but to break the ice, here’s a simple Omino Python script to do some drawing.

The script in Python. I didn’t know Python before starting the project, but it’s a nice easy little language, and quite popular, so there’s plenty of resources to learn it. It’s not so different from JavaScript or anything else. No semicolons and no curly braces, though! Here it is:

import math
import random

def ompy_main(c):
    ctx = c.layer_out_context

    w = int(c.width)
    h = int(c.height)

    # draw a red circle...
    ctx.set_source_rgb(1,0,0)
    ctx.arc(w/2,h/2,100,0,2 * math.pi)
    ctx.fill()

    # effect parameter controls size
    size = c.floats[0]
    ctx.set_font_size(size)

    # draw a grid of random numbers, spaced by 30
    random.seed(c.frame) # start the random sequence
    for x in range(0,w,30):
        for y in range(0,h,30):
            # random color
            ctx.set_source_rgb(random.random(),random.random(),random.random())
            # random number
            n = str(random.randint(0,9))
            # draw it.
            ctx.move_to(x,y)
            ctx.show_text(n)

And here’s a screen shot showing the output:

Op scrnshot 6

Your script can access a collection of parameters — some floats, some colors, &c — and use them as needed. In this case, I just used one float parameter to control the size of the random numbers printed.

This is just the beginning! Read the doc for the full story. Try out the plug-in.

More to come!

8 comments
GCoda // Mon 2011.02.14 02:582:58 am

This is great.
How about integrate this with http://code.google.com/p/pybox2d. Is it theoretically posible ?

Tutorialz | Copy. Share. Enjoy. » Omino Python: Python Plug-in for After effects // Mon 2011.02.14 05:495:49 am

[…] Van Brink (@polyomino) released Omino Python, a free After Effects CS5 plug-in for Mac OS X only (for now) that embeds a Python interpreter: […]

Jonas Hummelstrand // Tue 2011.02.15 03:593:59 am

Way cool, David!

Tweets that mention David Van Brink brings Python back to AE. Awesome! Useful Things was a favorite. -- Topsy.com // Tue 2011.02.15 04:314:31 am

[…] This post was mentioned on Twitter by Jonas Hummelstrand and kripats, Dale Bradshaw. Dale Bradshaw said: David Van Brink brings Python back to AE. Awesome! Useful Things was a favorite. http://t.co/Gui2CLA […]

Omino Python: Python Plug-in for After Effects | Wizpress.com // Tue 2011.02.15 09:359:35 am

[…] Van Brink (@polyomino) released Omino Python, a free After Effects CS5 plug-in for Mac OS X only (for now) that embeds a Python interpreter: […]

Mylenium’s Blog » The Snake comes back! // Tue 2011.02.15 11:4511:45 am

[…] How do you know that you are "old" in the After Effects world? When you can remember pretty much every cool plug-in that there once was and whose demise you regret. One of those was Useful Things, a custom framework for building your own effects using Python. I’ve long been a sucker for parametrical/ generative graphics – anything from L-Systems to statistical visualization – and have long wished we could have something like Processing would make its way to After Effects to fill that gap, but it hasn’t happened. Luckily, things are beginning to look a bit better, as we are getting a new Python plug-in thanks to David van Brink. […]

Michael Delaney // Thu 2011.06.2 22:4510:45 pm

Wanting to try out the plugin. Its throwing this though.

“Could’nt find main entry point for omino_python.plugin

48 :: 72”

I’m on OSX 10.6 with AE 10.0.0.458

david van brink // Wed 2011.12.28 19:467:46 pm

A little bit late, I reply: Try the newest version, fresh today. I rejiggered the installer significantly, hopefully addressing exactly this kind of problem. But please ping me here or poly@omino.com, I want to help!

oh, i dont know. what do you think?


david van brink // Tue 2011.01.25 08:57 // {Uncategorized}

Walter Murch: Wrong About 3d

Oh, Walter, Walter, Walter!

If you have not yet read Walter Murch’s book “In the Blink of an Eye”, get thee to a one-clickery and remedy that.

The book is about film editing… I guess. It’s an insightful meander about human perception, dreams, storytelling, and the question: “Why can we understand film-cuts?” He’s intelligent and articulate, and of course he’s a behind-the-scenes guy who worked on Great Movies so he’s got cred too. Really thought-provoking and inspiring.

Alas, I fear he is on weak footing with his recent dismissal of stereoscopic movie-making.

Roger Ebert includes a letter from Walter Murch in a recent column.

His central thesis: 3d movies don’t work, because focus and convergence are misaligned, and 600 million years of evolution don’t support that, so 3d movies give you a headache. That is to say, when the hero-prop thrusts out of the screen til its a foot from your eyes, you need to cross your eyes (convergence) but the actual image is still 50 feet away on the screen (focus). Never happens in nature.

Walter, Walter, Walter! You of all people, who have exploited and shared your deep understanding of just how malleable our percept-system is, should know better! We are more flexible even than evolution requires! By your reasoning a movie closeup shouldn’t work, because it’s 50 feet away, but as big as if it was next to you! It makes no sense. And neither do photographs or cave paintings.

Don’t get me started defending my beloved collection of vintage ViewMaster discs. And why does written language work? Why, why, why.

But it all does. Somehow. And stereoscopic movies are Known To Be Fun.

Every art form has a learning curve. Some art can’t be enjoyed unless you’ve built up to it, learned its language.

Every technology has its artifacts, but its the artists who work with them that determine their ultimate value and efficacy.

And, kids these days, they’ll just keep coming up with new combinations of them. We’ll never keep up.

Still. I’m… sorry that 3d glasses give you a headache. 🙁

oh, i dont know. what do you think?


david van brink // Sun 2010.12.26 17:47 // {general}

Beziers

We most of us use Bezier curves all the time, for masks, shapes, animation curves. They’re pretty intuitive. Points, control handles… yeah, you can usually get them to do what you want.

To do some math recently, I googled a bit more about them. They’re named from Pierre Bezier (1910-1999) who popularized them for CAD while designing cars for Renault. The standard “two-handle” style used by Adobe apps (and most others) is a “cubic Bezier”, because the equation uses some cubes.

To walk a cubic Bezier mathematically, given the four points (two end points, and two intermediate control handles), you can use this Python code, varying t from 0.0 to 1.0:

# given points p0, p0Out, and p1In, and p1, and t varying from 0.0 to 1.0...
a0 = (1 - t) ** 3
a1 = 3 * (1 - t) ** 2 * t
a2 = 3 * (1 - t) * t ** 2
a3 = t ** 3
# calculate x and y
x = a0 * p0.x + a1 * p0.xOut + a2 * p1.xIn + a3 * p1.x
y = a0 * p0.y + a1 * p0.yOut + a2 * p1.yIn + a3 * p1.y

But that’s all tricky. Here’s an intuitive way to visualize just what the heck a Bezier curve really (for really) is:

I did this animation in Python… stay tuned for much more on that front.

Super kudos to bimixual.org for the clear explanation.

oh, i dont know. what do you think?



0.0316s
(c) 2003-2023 omino.com / contact poly@omino.com