Mold lets you make crisp shapes in Godot and Unity. DK Liao built it while trying to render hundreds of tiny pieces in his own game.
DK Liao was making
Autopanic, a twin-stick shooter whose enemies are built from stacks of small, pixel-like shapes. Pieces break away as they take damage, so you can see the enemies wearing down. But a single enemy could have around
700 pieces. Keeping each one as a separate Unity object became too costly.
DK began drawing those pieces with Unity’s
Graphics.RenderMeshPrimitives. He wanted more control over how they looked, too. The renderer he built for the game became
Mold, which he later brought to Godot.
With Mold, you can add shapes as nodes in Godot and adjust them in the editor, or create them through code.
For 2D shapes, Mold draws quads and uses a signed distance field in the shader to work out their outlines. That keeps a circle crisp when you change its size. Mold also leaves a little room around each shape so the shader can smooth its edges.
3D shapes work differently. Mold builds them from meshes, then reshapes reusable templates in a vertex shader. It lowers their detail at a distance and fades between versions so the change is less noticeable.
Godot handles shape data differently from Unity. In Unity, DK uses graphics buffers; in Godot, he packs the data into color textures that the shader can read. Mold has both GDScript and C# versions for Godot.
DK also moved curves to the GPU. Changing one no longer means rebuilding its mesh on the CPU each time. The paint and pencil styles started as custom shader examples, but DK found them useful enough to include with the library.
You can try Mold’s sample scenes on itch.io. Its free non-commercial version has the same features as the paid one.
Want to make your own shader effects?