Noise Loop Node
It's official! We now have a seamless looping noise node.
Noise_loop was developed in close collaboration with longtime Nodebox artist Floris de Jonge. Floris asked for a way to create seamless looping animations with organic noise and created a first draft using Claude, an artificial intelligence. I suggested using a four-dimensional simplex algorithm and asked Floris to ask Claude for help writing the external Python module. It took Floris 15 iterations with Claude, but they came up with a working module. I then modified the Python to allow a seed input and wrapped it in a more user-friendly subnetwork.
This is a bit of breakthrough and opens the door to more AI-assisted modules. It's challenging writing modules for Nodebox because they have to be written in the now archaic 2.7 version of Python with no additional library dependencies. Most of the open source code out there uses math libraries to do the heavy lifting, and my Python skills are not sufficient to reinvent those wheels. This node is proof of concept that an AI can fill this gap and write Python code that is Nodebox-friendly. For more about the process developing this node see http://support.nodebox.net/discussions/nodebox-2-3/7237-seamless-an...
Noise_loop is similar to the existing Noise node. It takes X,Y coordinates and a Z time coordinate (from a frame node) as input and returns random values for each coordinate that you can use to drive organic movement or static designs. Noise uses a classic algorithm by Ken Perlin. Noise_loop uses a simplex algorithm also by Ken Perlin that is now no longer under patent restrictions. Noise returns values from -1 to 1; noise_loop returns values from 0 to 1.
But the big difference is looping. Noise works by moving linearly though a 3D space, just as an analog movie moves linearly through a stack of 2D frames. This is great for organic motion like clouds drifting across a sky but, like real clouds, makes it hard to loop the animation seamlessly.
Noise_loop, in contrast, moves in a circle through a 4D space. This may seem a tad mind-boggling but is actually not that hard. Two dimensions of time instead of one allows a two-dimensional motion path (like a circle) in place of a one-dimensional straight line. The effect looks very similar to classic Perlin noise, but returns to the same pattern at the end of each cycle.
Noise_loop takes 6 parameters:
- Points. A list of points, usually generated from a grid node. This provides the X and Y inputs.
- Frame. The current frame of the animation provided by a frame node.
- Frames per cycle. The number of frames required to come full circle. Usually set to the length of the movie.
- Scale. The apparent distance from the pattern. 100 is the default; reduce to zoom in, increase to zoom out.
- Speed. The animation speed. 100 is the default; reduce to slow the pace, increase to speed it up. The circle radius will automatically adapt to whatever speed you provide to maintain the specified cycle length; the slower the speed, the tighter the circle.
- Seed. A random seed. Change to generate different patterns.
Although noise_loop is optimized to produce seamless animations, you can use it for anything you need random numbers for. If you don't want your animation to loop, just set the Frames per cycle to a value longer than your movie length. You can also loop multiple times if other things are going on; as long as movie length is an even multiple of Frames per cycle, the patterns produced will loop seamlessly.
The output can be used to drive static designs (like gradients) as well as animations. You will get one random value between 0 and 1 for each point coordinate input. If you don't need both X and Y coordinates, just use a make_point node to convert a list of values to points with a constant value (e.g. 0) for the Y coordinate.
The attached demo shows a typical animation that looks something like a lava lamp of globules floating around. I feed in a grid of 3750 (75 x 50) pixel coordinates with the frame node to provide motion for 250 frames. The cycle length is also 250 to create a single seamless loop. Feel free to adjust the scale, speed, and seed to change the output.
Instead of providing a single gradient of 3750 colors, I use the subsets node to use only 3 colors, with the first used twice as much as the other two. The colors are provided by my sanzo_color node; change the Number value on that node to quickly step through many possible color combinations.
I have attached the resulting animation. If you play it continuously you will see that it loops seamlessly each 10 seconds.
Noise_loop requires an external Python module, simplex_noise_4d.py, included in the zip file. Be sure to copy the module and add it to your project's Code Library declaration any time you use this node.
I would love to see what people do with this. Go forth and create!
-
noise_loop_screenshot.png 521 KB
- noise_loop_demo.mp4 417 KB
- noise_loop_demo.zip 21.8 KB
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac