From seconds a frame to 15 FPS: Gaussian splats on the Saucelet
· 12 min read
By Phil · building Legitsauce
Ten days ago I wrote about one Godot frame on a keychain. Frame 1440 of Godot's third-person shooter demo took 30 seconds to render on the ESP32-P4, the chip that does the 3D in the Saucelet. That was a big drop from almost two hours, but a game has to draw dozens of frames every second.
This post covers what happened next. A game with this kind of AAA look won't run on the P4 with a traditional triangle rasterizer. Gaussian splats are showing promise: the same hallway, with the robot walking, jumping and turning, now runs at 15.5 FPS on the P4 at 240 by 240.

How I measured
The setup is the same as last time, with one change. A still frame doesn't tell you if a game is playable, so every number here comes from a moving demo:
- A 10-second clip. The robot walks into the divider, jumps and lands, with collision and its animations. Then it stands still while the player turns the third-person camera 90 degrees.
- Frames per second while moving. That's the average over the walk, the jump and the turn. A still camera is faster, and I don't count it.
- Measured on the board. An M5Stack Stamp-P4: two RISC-V cores at 360 MHz, 768 KB of on-chip RAM and 32 MB of PSRAM. The output is 240 by 240, the Saucelet's screen size.
- My eyes decide. Every change comes with side-by-side pictures against Godot, and I judge the look. An error number is computed too, but it doesn't get a vote.
Triangles hit a wall
After the 30-second frame I kept pushing the triangle renderer. I switched off everything that real-time games usually leave out: the screen-space effects, the live bounced light, the volumetric fog and the glow. What was left was rasterization, textures and baked lighting. That frame took 4.9 seconds, 294 times too slow for 60 FPS. Shading took about 14,500 cycles for each shaded pixel.
Then I wrote a second triangle engine from scratch, built only for speed. Godot's lighting, fog and glow were baked into the textures, fitted to Godot's own images, so the chip only had to draw textured triangles. It rendered at 480 by 480 and shrank the result to 240, because at 240 the triangle edges looked too rough.
It ran at 2.9 FPS while moving, with frames as slow as 427 ms. Filling pixels was limited by reading textures from PSRAM. Even with every stage tuned, my estimate for this hallway was about 17 FPS, before adding the see-through grates and glass, which cost another 10 to 35 ms a frame. The level also needed 11.7 MB of data.

A scene like this has a lot of small triangles, many textures and many transparent surfaces. On a chip without a GPU, that adds up to too much work per pixel. I've parked the triangle engine. It may come back for simpler games with fewer, larger surfaces, but it won't run this one.
Why Gaussian splats
A Gaussian splat is a small, soft, coloured blob in 3D space. A scene is made of tens of thousands of them, and they're trained, not modelled. I render a few thousand views of the level in Godot, then a GPU on my PC adjusts every splat's position, size, shape, colour and opacity until the splats reproduce those views. The lighting, the fog and the bounced light come along for free, because they're in the pictures the splats learn from.
On the chip, each frame does the same few things:
- Find the visible 2 m cells of the level, and the visible clusters of 64 splats inside them.
- Project every visible splat to a 2D ellipse on the screen, 8 splats at a time.
- Sort each 16 by 16 pixel tile's splats from front to back.
- Blend them into the pixels, 8 pixels at a time, and stop at each pixel once it's covered.
- Add fog and tone mapping, and dither the result down to the screen's colours.
There are no textures and no per-pixel lighting. The cost depends on how many splats a pixel touches, not on how complex the materials are. That suits a chip with fast integer vector maths and slow memory.
From 30 seconds a frame to 15.5 FPS
| Date | What changed | FPS |
|---|---|---|
| Oct 18 | Triangles, the full Godot look (last post) | 0.033 |
| Oct 21 | Triangles, only the real-time pieces | 0.20 |
| Oct 22 | The first Gaussian splats, floating-point maths | 1.9 |
| Oct 22 | Splat levels of detail and cheaper blending, the same day | 5.7 |
| Oct 23-26 | Fixed point and SIMD from storage to screen, trained splats, a splat robot with animation | 7.4 |
| Oct 27 | Big opaque shapes mixed in for walls and floors | 8.6 |
| Oct 28 | Splats only, the opaque shapes removed | 11.2 |
| Oct 28 | Shaped splats, a quarter as many | 16.0 |
| Oct 28 | The same, with a fixed-point overflow fixed | 15.5 |
The two triangle rows are a single still frame. The first two splat rows were measured on a walk through the level. From Oct 23 on, the numbers come from the robot's jump demo while moving, and from Oct 27 on, from the 10-second clip above.
Two changes did most of the work.
The first was moving every splat and pixel step to fixed point and SIMD. More on that below.
The second was shaped splats. A plain Gaussian splat is soft all the way to its edge, so a straight edge or a flat wall takes many overlapping splats. I added two shapes: a flat-top splat with a solid middle, and a splat cut by a straight line. The training now uses them to fit walls with fewer, larger splats and to keep edges sharp. The world went from 165,616 splats to 38,759, and the moving frame rate went from 11.2 to 16 FPS. I liked the look enough to make it the default.
The last row is slower on purpose. A value in the flat-top splats could overflow its 16-bit field and draw a dark square slab. Fixing it in training closed visible gaps around the hallway's lights for 0.5 FPS, and I took that trade.
Fixed point and SIMD everywhere
In the last post, fixed point made the triangle renderer twice as slow. Its lighting needed 64-bit multiplies and divides. Splats are different: everything fits in 16 and 32 bits, so fixed point wins.
The P4's cores have a vector unit called PIE. One instruction works on 128 bits at once: 8 numbers of 16 bits. It has no divide, no square root, no floating point and no way to look up a table per lane. So every stage that runs per splat or per pixel is integer maths written for 8 lanes:
- Storage: a splat's position is 8-bit numbers from the centre of its 2 m cell. Its two axes are 8-bit numbers with a shared exponent. Its colour is an index into a palette of 4,096 colours. A splat takes 16 bytes.
- Projection: one hand-written assembly kernel projects 8 splats per pass, using PIE's hardware loops and its wide multiply-accumulate registers. It takes about 230 cycles a splat. The floating-point version it replaced did one splat at a time and took about 480.
- Blending: 16-bit lanes, 8 pixels per instruction, hand-scheduled. Each pixel stops once it's more than two-thirds covered, and a row is skipped once all its pixels have stopped.
- Output: fog, tone mapping and dithering run 8 pixels at a time too.
The only floating-point maths left runs once per frame, per 2 m cell or per bone of the robot: a few thousand operations, against millions of integer ones.
Where the maths needs a divide or a square root, an approximation does the job:
- Divide: 1/z starts from a cheap estimate and improves it with Newton steps, which are only multiplies and adds.
- Inverse square root: the ellipse needs two of them per splat. Each one starts from a straight-line guess and takes two Newton steps. It used to take three. I refitted the constants for two steps and the frames didn't change in any way I could see: the average difference was 0.045 out of 255 per colour channel. Two multiply-add steps for 8 splats at once cost far less than a real square root, which the vector unit doesn't have anyway.
- Bounding box: the splat's box on screen uses a three-chord approximation of a square root. It's at most 2.7% too big, with no root at all.
- Depth key: the sort key is a piecewise log2 built from compares.
- Splat shape: the falloff is a polynomial instead of an exponential.
None of these approximations caused a visible glitch.
Where it stands today
The current default:
- The world: 38,759 splats trained from about 2,800 Godot renders, with soft, flat-top and edge-cut shapes. With the coarser levels of detail for far cells, 51,656 splats in total.
- The robot: 9,882 splats bound to 145 bones, playing Godot's animation clips. Its lighting is computed every frame from a grid of light samples, so it's lit correctly wherever it walks.
- Collision from Godot's level, and a low-resolution panorama for anything the splats don't cover.
- Colour: 12-bit colour with a 4 by 4 dither for now. 16-bit colour comes later.
| FPS while moving (walk / jump / turn) | 15.5 (14.2 / 14.2 / 17.4) |
| FPS with a still camera | 19.9 |
| Slowest moving frame | 76 ms |
| Firmware | 533 KB |
| On-chip RAM | 238 KB fixed, plus up to 251 KB per frame |
| PSRAM | about 3 MB of 32 MB |
| The whole level, stored | 5.3 MB |
Each frame draws about 11,600 splats. Here's where its 61 ms goes:
| Stage | ms |
|---|---|
| Blending into pixels | 33.8 |
| Projecting splats | 11.4 |
| Fog | 4.5 |
| Posing and lighting the robot | 3.8 |
| Finding visible cells | 2.3 |
| Sorting splats into tiles | 1.7 |
| Output | 1.9 |
| Set-up | 1.0 |
The image isn't great. Next to Godot it's softer, the dither shows, bright lamps blow out, and thin bars like the railing come and go. On the Saucelet's 1.3-inch screen it looks fine, and I expect a few tweaks to improve both the look and the speed.
Things that didn't work
- Reusing parts of the previous frame. Faster with a still camera, but 4 to 8 ms slower on every moving frame.
- Fewer splats on the robot. Even a quarter fewer was visible to me, because the robot is always close to the camera.
- Training the splats to overlap less. It gained 3%, and the look got slightly worse, so I kept the current world.
- Refreshing distant parts of the scene less often. About 75% of the work is in the near part of the hallway, so the bookkeeping cost more than it saved.
- An 8-bit blend. A simulation put the best case at half a frame per second faster, with a risk of colour banding, so I didn't build it.
How far 45 FPS is
My goal is 45 FPS while moving. That's 22 ms a frame, against 61 today, so it needs to get about 2.7 times faster. That's still a long way.
I know where most of the time goes. Of about 1.5 million splat-pixel tests in a frame, only about one in seven changes a pixel. About 45% of the blending time isn't per-pixel maths at all: it goes to setting up each splat on each tile and sorting each tile's list. The next things to try:
- Set up 8 splats per tile at once with SIMD, the way the projection already works.
- Sort the visible splats once per frame instead of once per tile.
- Cut the robot's 3.8 ms of set-up, which is a lot for one character.
- Bake the fog for static parts of the level.
- Keep both cores busy for the whole frame.
- Move to the 400 MHz version of the P4 at the end, for about 11% more on everything.
None of these should change the picture. I'll post again when the frame rate moves.