Procedural Suminagashi: Simulating Ink Marbling with py5

2026/8/13

The ancient arts of Suminagashi and Turkish Ebru marbling involve floating pigments on the surface of water and carefully manipulating them to create intricate, flowing patterns. "Fluid Dynamics Ink Marbling 2D" brings this delicate physical process into the digital realm. By combining dense particle systems with procedural noise fields, we can simulate the complex fluid dynamics that give marbled paper its signature organic aesthetic.The visual result is a soothing, ethereal animation. Drops of vibrant ink stretch, twist, and fold into one another across a textured off-white canvas. Using Python and the py5 library, we can easily manipulate thousands of individual ink particles, subjecting them to continuous mathematical currents that mimic the chaotic beauty of fluid vortices.

Visual & Aesthetic Approach

To faithfully recreate the look of physical ink marbling, the rendering technique must capture both the crisp lines of fresh pigment and the soft diffusion of older ink dissolving into water.This is achieved using a persistent canvas with a very slow fade. Instead of clearing the background every frame, a highly transparent rectangle (alpha = 2 out of 100) of the paper color is drawn over the entire canvas. This means that as the ink particles move, they leave a trail that slowly softens and fades, perfectly mimicking pigment bleeding into a viscous fluid base. The color palette utilizes vivid, randomized HSB hues against a warm, off-white "paper" background to maximize contrast.

Code & Technical Breakdown

The simulation relies on two core mechanisms: initializing the ink drops with a natural distribution, and driving their movement using a specialized noise field to simulate fluid turbulence.

Natural Ink Drop Distribution

When real ink hits water, it doesn't spread uniformly; it tends to be denser at the center of the drop. In the setup() phase, we generate 30 distinct drops, populating each with 500 particles.
for _ in range(30):
    cx = py5.random(SIZE[0])
    cy = py5.random(SIZE[1])
    hue = py5.random(360)
    radius = py5.random(50, 200)
    
    for _ in range(500):
        # The extra random(1) concentrates particles near the center
        r = py5.random(radius) * py5.random(1) 
        a = py5.random(py5.TWO_PI)
        x = cx + r * py5.cos(a)
        y = cy + r * py5.sin(a)
        particles.append({'x': x, 'y': y, 'hue': hue})
Multiplying the radius by a second random float (py5.random(1)) skews the distribution, packing more particles near the center of the drop while letting the edges remain diffuse.

Curl-Like Noise for Fluid Dynamics

To move the ink, we calculate a vector field for the particles. Standard Perlin noise often creates flow fields that look like windswept fields or wood grain. To simulate liquid vortices and marbling, we use a technique akin to curl noise.
time = py5.frame_count * 0.005

for p in particles:
    # Scale down the coordinates for the noise space
    nx = p['x'] * 0.002
    ny = p['y'] * 0.002
    
    # Multiplying by 4pi creates tighter, vortex-like curls
    angle = py5.os_noise(nx, ny, time) * py5.TWO_PI * 4
    
    vx = py5.cos(angle) * 3
    vy = py5.sin(angle) * 3
    
    p['x'] += vx
    p['y'] += vy
    
    # Draw the ink particle
    py5.stroke(p['hue'], 80, 80, 30)
    py5.point(p['x'], p['y'])
By multiplying the noise output by 4 * pi instead of the typical 2 * pi, the resulting angle wraps around the circle multiple times within a short spatial distance. This causes the vectors to loop back on themselves, creating the tight, swirling vortices and eddies that characterize marbled paper. As the time variable slowly pushes the 3D noise field along the Z-axis, these vortices shift and push the ink across the canvas.
fluid dynamics ink marbling 2d p1

Conclusion

"Fluid Dynamics Ink Marbling 2D" demonstrates how slight tweaks to foundational generative techniques can yield drastically different aesthetic results. By concentrating initial particle distribution and amplifying the rotational bounds of a noise field, a simple particle system transforms into a rich, fluid simulation. It bridges the gap between ancient analog art forms and modern creative coding.