Haunted Tesseract Demo

This Halloween Tesseract Demo was built using Rive, with a combination of the Rive Editor, Rive CLI, Rive's GPU Canvas, custom WGSL shaders for simulation and rendering, and Luau Scripting. Some of the development was done in collaboration with Claude Opus 5.5, using Project Feeds media review tooling, tasks and agent handoffs.

My primary purpose in developing this Rive demo was to thoroughly vet if Rive was capable of advanced 3D feature implementations, and to stress test Project Fee's Rive viewer & review tooling.

Spoiler alert, both passed with flying (in this case spooky) colors!

The Demo Itself

Before I get into the specifics, I'll go over the overarching implementation.

The Rive scenes run through Rive's GPU Canvas, using custom-built WGSL shaders that control the simulation and rendering.

The Rigid-body physics and interactions were handled by Luau scripting, where I passed the cube's movement and event state's into the GPU buffer so the shaders can properly respond to what is happening in the scene. More on that later!

If you're wondering why Luau, then you'll have to check out Rive's article: Why Rive Scripting Runs on Luau. It gives you a good understanding of their thought process for choosing Luaua over popular alternatives.

Going more into the depths of it, I heavily used fluid solves for most of the dynamics; soot, dog, blood, etc. These fluid solvers use the custom WGSL fragment shaders to update the simulation data stored in custom textures.

Each pass reads the current state, then writes the result into a separate texture. Swapping the input and output for the next step. Throughout this process, the simulation stays on the GPU.

Inside the Tesseract (the cube) itself, I have the gas running on a 40 x 40 x 40 grid, with its depth slices packed into a 2D texture atlas. This allows the shaders to properly sample it as a volume.

Advection, or rather a simulated version of it, carries the gas through the established velocity field. Then I implemented a pressure solver to correct the flow to reduce any type of divergence, while the vorticity confinement helped preserve the sleek gas curls that give the smoke its effect.

And on top of that, I added a finer density field detail to keep the broader shapes readable.

To render the volumes themselves, the scene shader marches along each individual camera ray and accumulates light/opacity from the samples it takes through the different gas/fire effects. The ray intersections locate both the Tesseract glass and floor, and the glass reflections grow stronger at grazing angles, where you see the surface almost edge-on.

Still with me? When it comes to fluid/gas dynamics, there's a lot of physics and math involved. And this isn't even half of it!

Next up, I'll be going over what I did for the individual themes; blood, haunt, demonic.

The Blood Theme In Depth

The Bloody Tesseract is by far my favorite, it turned out great! And in hindsight, I should have focused my attention on this instead of splitting it across three themes. Regardless, it came out well.

The primary reference was The Butcher from Diablo 1. I wanted to capture the sense of fear and dread I felt when I first came across his room when I was a child.

The majority of the work here was in how the blood responded to the Tesseract. It needed to lag behind the movement, and wash up against the glass before settling, with enough weight that you could “feel” it through the interaction.

While the implementation in the demo is a bit dull, that was primarily due to balancing effect with performance. And in particular web performance. I originally had a much higher quality fluid solver, but that caused some headaches with getting idea performance when not running standalone. So I dumbed it down a bit.

But going into more details, the resting surface is a plane, dot(p, n) = d, where p is a position inside the cube, n is the surface's up direction, and d sets its level. That upward direction follows gravity adjusted for the cube's acceleration, with the acceleration smoothed and limited to keep sudden impacts manageable.

And as the orientation changes, I used bisection to find the level that leaves around 60% of the box's volume below the plane. With the fill staying consistent even when the cube lands on a corner.

A 96 x 96 GPU height field adds the waves over that surface, with damping and viscosity softening the smaller motion into a slow, heavy slosh.

The custom shader updates each cell from its four neighbors using the difference in height and vertical speed to propagate the waves.

Then a restoring force pulls the displacement back towards the resting plane. Which controls how far the blood climbs the glass, and how quickly it settles afterward.

For the surface normal, I derive that from the surface height's slop, sampling either side of a point to estimate how steeply the liquid rises in each direction. In the surface's local frame, that's N = normalize(n - u * dh/ds - v * dh/dt). Here, h is the height displacement, and u and v follow the surface coordinates s and t. The same waves that move the surface also move its reflections, breaking up the moonlight as the blood sloshes.

For the reflection strength, I use Schlick's Fresnel approximation, F = F0 + (1 - F0) * (1 - NdotV)^5. Here, NdotV measures how directly the surface faces the viewer, and the blood uses F0 = 0.03. It reflects little head-on, then becomes much more reflective toward its edges. Depth absorption follows T = exp(-sigma * L), with separate absorption coefficients for each color channel and L representing the distance light travels through the blood.

That gave the liquid its darker interior, with a small meniscus catching the light where it meets the glass, and wet streaks remaining where it climbed.

But I wasn't done. I added more horror by having hands slap the Tesseract from the inside, wanting to be released. These are done using procedural thickness fields rendered in the cube faces' UV coordinates using WGSL. With their silhouettes coming from a 512 x512 texture atlas containing 16 different hand print masks for variation.

In addition to all of that (yes there's more), if you listen carefully, there's a dreaded heartbeat in the ambience. The heartbeat uses the audio-playhead-driven event scheduling, where on each simulation update, Luau reads the playback position of the loudest active ambience and triggers the beat.

Each beat raises a shared pulse envelope using pulse = max(pulse, beatStrength × bloodBlend), followed by exponential decay, pulse *= exp(-6 × dt). The shader receives this envelope as a uniform and adds a radial displacement to the existing fluid surface: Δh = 0.14 × pulse × (exp(-r² / 0.2) - 0.2).

This produces a central swell with a smaller downward displacement around it, layered over the simulated waves. The surface normals are derived from the combined height function, so reflections respond to the deformation.

In the end, it's a small, subtle detail. But it added a lot to the ambience.

For the following themes, I'll go a lot less in-depth as most of the same concepts apply.

Haunt Theme, not in depth

For the Haunt theme, I went with a softer approach, with souls of the damned that emit ectoplasm into a gas field as they drift endlessly around the Tesseract.

The ghost shapes are formed directly within the simulated gas density itself. When a spirit screams, a Luau controller selects on of ten procedural forms and sends it position lunge strength, mouth opening, and orientation to the GPU.

A custom WGSL script then contracts each form from analytic implicit shapes, such as ellipsoids for heads, capsules for limbs, and tapered volumes for robes. With separate cutouts for eyes and mounths.

A camera-aligned coordinate frame keeps the apparition upright and facing the camera as the cubes is rotated or thrown around.,

All-in-all, this gives the shape of the gas gathering into the form of a damned ghost that holds briefly before its form is torn apart again.

The ground fog uses a separate flow solver, drifting across the stage and curling around disturbances before it slowly closes over trails left by the pointer. Cold moonlight and mesh shadows give those banks of fog their depth, with finer mist adding texture over the broader flow.

Again, a lot of the same concepts of the Blood Theme, just adjusted to fit a different theme.

The Demonic Theme

For the final theme, the Demonic Theme, I wanted to heavily reference the feeling of the Lost Souls in the Doom (1993).

Inside of the Tesseract, instead of relentless suffering or spirits of the damned, it's a demon full of rage relentlessly trying (and succeeding) to escape.

Now for this fire demon, I collaborated with Claude with the goal of taking a 2D shape and giving it dynamic 3D flaming life.

Claude created a preprocessing script to build the depth around the silhouette, shaping the fine details. It then converts this geometry into a signed-distance field, packing the result into a 96 x 96 x 32 volume into a 2D texture atlas.

The combustion shader uses that distance field to emit fuel/heat, with stronger emission in the eyes. The chains were generated procedurally in WGSL using signed-distance geometry.

Ending the explanation there due to the character limit, but if you want more info, hit me up!

Closing

After working in Unreal Engine, Unity, Godot, etc over the past decade, I have to say I'm a huge fan of Rive. It's pretty powerful, but light-weight. I started using Rive with its editor, and with the introduction of the CLI, it just made it much more powerful.

For this demo specifically, I collaborated with Claude through Project Feeds media review tooling, tasks & agent handoffs to get a lot of the initial setup and proof of concept ready using the Rive CLI. Then I imported it into the Rive Editor to fine-tune and tweak the simulations and rendering implementations.

All-in-all, it's a pretty great experience, and I expect to use Rive a lot more in the future.

Project Feed Showcase

Loading Project Feed Showcase

Project Feed needs to reload

A newer version is live and this tab is still running the old one.

You're offline

Project Feed picks up where it left off as soon as you're back on a connection.

Project Feed couldn't finish loading

Some of the app's files didn't arrive. Check your connection, then reload.

Project Feed didn't finish loading

Something stopped the app's files from arriving. Reloading usually clears it.

Reload page