1. NodeBox 1
    1. Homepage
    2. NodeBox 3Node-based app for generative design and data visualization
    3. NodeBox OpenGLHardware-accelerated cross-platform graphics library
    4. NodeBox 1Generate 2D visuals using Python code (Mac OS X only)
  2. Gallery
  3. Documentation
  4. Forum
  5. Blog

kernel panic by movie export

Posted by toby_ on Jun 04, 2008

Dear NodeBox Team,

i just start to make some tests of exporting different animations to check the smooth motion.
And my first try is the hardest i think::

this example of boids shows some itunes like animations.
it is running fine in realtime play.
but if you try to export this as a movie, you will end up in a kernel panic. [save every think before 8)]

size(640, 480)
 
# Create a flock of boids.
boids = ximport("boids")
flock = boids.flock(6, 0, 0, WIDTH, HEIGHT)
flock.goal(WIDTH/2, HEIGHT/2, 0)
flock.noperch()
flock.scatter(chance=0.005, frames=10)
for i in range(10): 
    flock.update()
 
# Create a cached circle layer representing a boid.
# This is faster than creating the path from scratch each frame.
coreimage = ximport("coreimage")
canvas = coreimage.canvas(WIDTH, HEIGHT)
coreimage.PATH_PADDING = 0
firefly = canvas.append(oval(0, 0, 8, 8, draw=False), fill=color(1))
firefly.blur = 0
firefly = firefly.render()
screenshot = None
 
speed(30)
def draw():
    #flock.goal(MOUSEX, MOUSEY, 0)
    background(0.05, 0.05, 0)
    canvas = coreimage.canvas(WIDTH+10, HEIGHT+10)
    # Each frame, put a screenshot of the composition on the background,
    # scale, rotate, fade and blur it.
    global screenshot
    if screenshot:
        l = canvas.append(screenshot)
        l.scale(1.005)
        l.rotate(0.3)
        l.opacity=0.985
        l.blur = 1.0
    # Update the boids' position and draw them on the canvas.
    # Colorize each boid according to its x, y, and z-position.
    flock.update(limit=10, cohesion=40, alignment=100, goal=100)
    for boid in flock:
        l = canvas.append(firefly)
        l.filter("levels", 
            r=boid.y*0.020, 
            g=boid.z*0.010, 
            b=boid.z*0.001)
        l.x = boid.x
        l.y = boid.y
        l.opacity = 0.3 + boid.z*0.01
    # Grab a screenshot.
    screenshot = canvas.flatten()
    canvas.draw()


 
Posted by Tom De Smedt on Jun 09, 2008

The Core Image library has a known memory problem when you export artwork containing Core Image stuff. Each exported frame, the memory footprint will increase until you run out.

As long as we don't find a way to fix that I'd suggest you use an external screen capture tool (like IShowU) to create Core Image movies.



Posted by Tom De Smedt on Jun 27, 2008

The Core Image leak occurs when a Cocoa CIImage is copied into an NSImage, in other words when the image data moves from VRAM to RAM. Below are some posts on the subject, though none of the proposed solutions have worked for NodeBox so far:

http://theocacao.com/document.page/350
http://inessential.com/?comments=1&postid=3390