Shattering the Sphere: Rendering Liquid Chrome Fracture in py5

2026/7/20

“Liquid Chrome Geometric Fracture 3D” is a generative media art piece that explores the tension between perfect geometric forms and violent structural collapse. The artwork centers on a sleek, highly reflective metal sphere suspended in a deep void. Rather than remaining static, the sphere slowly pulls apart, fracturing into thousands of mirrored shards that spin wildly before coalescing back into a perfect whole. By leveraging Python, py5, and NumPy to manually calculate 3D geometry, face normals, and dynamic lighting, the piece captures a mesmerizing, cinematic dance of light and shattered metal.

Visual & Aesthetic Approach

The aesthetic of “Liquid Chrome Geometric Fracture 3D” is heavily reliant on its sophisticated lighting model. Instead of drawing flat colors or wireframes, the artwork uses py5’s powerful 3D renderer to simulate a dense, highly polished metal surface.

Set against a deep, void-grey background, the chrome material is defined not by its base color, but by the light it reflects. The scene is illuminated by two contrasting directional lights: a warm, burning orange on one side, and an icy, cold blue on the other. Because the metal is set to have extreme shininess and intense white specular highlights, the surface of the sphere catches these colors beautifully. When the fracture event occurs, the thousands of individual triangular shards explode outward and begin to spin. As they tumble, their varying angles catch the orange and blue lights unpredictably, creating a dazzling, glittering storm of liquid chrome that feels incredibly weighty and tactile.

Code & Technical Breakdown

To fracture a 3D object, you cannot simply use a pre-built sphere primitive like py5.sphere(). You must mathematically construct the geometry from scratch so you can control each individual face.

# From setup()
# Connect vertices into triangles
for i in range(lats):
    for j in range(lons):
        # ... vertex index calculation ...
        
        # Triangle 1
        n1 = np.cross(p2 - p1, p3 - p1)
        n_len = np.linalg.norm(n1)
        if n_len > 0: n1 /= n_len
        center1 = (p1 + p2 + p3) / 3.0
        
        faces.append({
            "v": [p1, p2, p3],
            "normal": n1,
            "center": center1,
            "rot_speed": np.random.randn(3) * 0.05
        })

Why this works: The setup phase builds the sphere using latitude and longitude math. However, the critical step happens when the vertices are connected into triangles. For every triangular face, the code calculates two vital pieces of information: the center of the triangle (the average of its three points), and its normal vector (the direction the face is pointing). The normal is found using NumPy’s cross product (np.cross). By storing this geometry as a list of independent dictionaries rather than a single unified mesh, the simulation is prepared to break the object apart. Every face is an island, completely decoupled from its neighbors.

With the geometry established, the rendering loop orchestrates the fracture and the lighting.

# From draw()
# Chrome lighting setup
py5.light_specular(255, 255, 255) # White specular highlights
py5.directional_light(30, 100, 80, -1, 1, -1) # Warm orange
py5.directional_light(200, 100, 100, 1, -1, -0.5) # Cold blue
py5.ambient_light(50, 50, 50)

# Material properties
py5.specular(255, 255, 255)
py5.shininess(50)

Why this works: This block transforms the flat triangles into liquid chrome. py5.specular() and py5.shininess(50) tell the renderer to treat the material as highly polished, creating tight, intense hotspots where light hits. The two py5.directional_light() calls provide the cinematic color contrast. Because the lights are aimed from opposing diagonals ([-1, 1, -1] and [1, -1, -0.5]), they catch the edges of the shattered geometry perfectly, dramatically separating the tumbling shards from the dark background.

The actual fracture is achieved by manipulating the transformation matrix of each individual face during the drawing loop.

# From draw()
# Fracture wave
fracture_amount = (np.sin(t) * 0.5 + 0.5) # 0 to 1

for f in faces:
    py5.push_matrix()
    
    # Calculate how far to push this face out based on its center
    n = py5.os_noise(f["center"][0]*0.01, f["center"][1]*0.01, t)
    
    # Explosion offset
    offset = f["normal"] * (fracture_amount * n * 800)
    
    py5.translate(*offset)
    
    # If fractured, also spin the shards
    if fracture_amount > 0.05:
        # We translate to center, rotate, translate back to spin in place
        py5.translate(*f["center"])
        py5.rotate_x(t * f["rot_speed"][0] * fracture_amount * 20)
        # ... (Y and Z rotations)
        py5.translate(*(-f["center"]))
        
    py5.begin_shape(py5.TRIANGLES)
    # ... draw vertices ...
    py5.end_shape()
    
    py5.pop_matrix()

Why this works: The fracture_amount is driven by a sine wave, guaranteeing the sphere will explode and reform in a perfect, continuous loop. Inside the loop, the code pushes each face outward along its own normal vector. This means every shard explodes exactly outward from the center of the sphere. The `offset` is multiplied by Perlin noise (py5.os_noise), ensuring the explosion is jagged and organic rather than perfectly uniform. Crucially, when a shard is pushed outward, it is also rotated. By translating to the face’s exact center before rotating, the shard spins perfectly on its own axis. When py5.pop_matrix() is called, the renderer forgets the transformation, ready to process the next shard independently.

liquid chrome geometric fracture 3d

Conclusion

“Liquid Chrome Geometric Fracture 3D” showcases the immense power of combining custom mathematical geometry with a robust lighting engine. By calculating face normals and managing the transformation matrix of thousands of individual triangles, the artwork achieves a level of cinematic destruction usually reserved for high-end 3D animation software. Built entirely in Python with py5 and NumPy, the simulation proves that code is a beautifully tactile medium, capable of rendering the heavy, shattering beauty of liquid metal.