Breakdown 3 of 4

The Unreal toolset

The in-editor toolset artists build with: search, 73 colours and stud snapping, holding 92.9 FPS with 6,406 actors in the editor.

Overview

This is the only part of Tool Brick an artist ever sees, so I wanted it to feel like part of the editor. It’s an Editor Utility Widget built with Unreal’s Editor Scripting Library, entirely in Blueprint, and it opens from a Tool Brick tab on the menu bar.

Search, categories and colour tinting.

The part browser

A data table imports the part list JSON from the Python stage and finds each part’s mesh and thumbnail in the content browser. The widget makes a UMG tile for each part, with a search box and a category dropdown on top.

To keep it responsive, the part objects are cached the first time they’re created, and tiles are only built for parts that match the current search. It stays quick even with thousands of parts, and finding one is faster than digging through the content browser. Parts without a thumbnail get a crossed out placeholder.

Placing bricks

Placement isn’t as friendly as the content browser, since there’s no drag and drop. As a compromise, it raycasts from the editor camera, places the brick on the first surface the viewport is looking at and selects it straight away so you can move it.

Every part is a Blueprint holding its mesh as an instanced static mesh, letting Unreal batch copies of the same part, and the meshes use Nanite to keep all their detail while staying cheap to render.

The Nanite cluster visualisation in the viewport, bricks and a baseplate broken up into small multicoloured patches, next to the details panel for a brick Blueprint with a BrickPos scene component holding a BrickMesh instanced static mesh, its transform showing location and rotation offsets of a few hundredths
Nanite clusters, and the instanced mesh inside a brick.

To check it held up, the release includes a performance test level, a field of red bricks. Flying around it in the editor at High scalability, the stat readout stayed between 80 and 93 FPS (10.7 to 12.5ms a frame).

The Unreal editor on the L_PerfTest level, the viewport filled with rows of red bricks receding into the distance, the outliner reporting 6,406 actors and the stat bar reading 92.9 FPS at 10.8ms
6,406 actors at 92.9 FPS in the editor.

Imperfection

Bricks snap to a 10 x 10 x 4 grid, one stud across and one plate high (the maths is on the Houdini page). Real bricks are never placed perfectly, though, and they’re made slightly undersized to leave some tolerance between them. So every brick is scaled down to 0.99 and given a small random offset in position and rotation. BrickNerd’s Oscar Cederwall goes into the odd sizes and tolerances behind this in more detail (Schefcik, 2022).

A close up of stacked yellow bricks under warm light, the seams between them uneven, with thin dark gaps where bricks sit slightly off from one another
Uneven gaps from the scale and offsets.

The brick values below are from a 2 x 4 in the showcase level, and the saved state is the config file that ships with the release.

  • float
  • bool
  • vector
  • int
  • string
  • random stream

BP_Brick

Part
Grid
Imperfection

ToolBrickConfig.json

Browser
Toggles
A placed brick, and the widget's saved state.

Colours

LEGO has released hundreds of colours, so I used BrickLink’s colour guide (LEGO Group, 2024) to decide which to include. A colour had to be from the main LEGO series, in current production and used on more than 100 parts, or be an active special colour. I also used BrickLink’s colour names throughout, since different platforms often name the same colour differently. That left 73:

The swatches are laid out as top-down bricks, like BrickNerd’s Chris Clarke laid out the 2023 palette, and Chris’s research into each colour’s hex code is what got the solid colours right (Clarke, 2023). Each colour is its own material instance, which also lets Unreal batch them.

Rows of 2 x 2 bricks floating in front of a blue sky under the words Here are all the colours and types that can be used, a staircase of solid colours on the left, then smaller groups of glitter, metallic, pearl and transparent bricks
Every colour and finish, in the colour showcase level.

The active colour applies to whatever you place next, and the part tiles are tinted to match. With a brick selected, clicking a swatch recolours that brick too.

The master material

For realism I relied on Stefan Müller, who has been studying LEGO materials since 2016 and breaks down what makes a brick look real on Stefan’s CG Blog (Müller, 2019). Not all of it works in real time without baking textures for every part, so I took the parts that do: the roughness breakup, scratches, dust and fingerprints.

An opaque master came first, for the solid colours, then a translucent master for the transparent ones.

The M_ToolBrick_MasterOpaque material graph in Unreal, organised into coloured comment boxes, with a glossy red sphere in the preview window on the left
For the solid colours. A translucent one came later.

The surface textures are ambientCG’s Smear 002 (ambientCG, 2018), Cornelius Dämmrich’s glossy maps (Dämmrich, 2025), Chris Spooner’s film dust textures (Spooner, 2018) and TextureCan’s fingerprint texture (TextureCan, 2024).

Stud snapping

When you select a brick, the tool spawns a snap handle on every stud the Houdini network found, and you can move the brick from any of them. Once you pick one, handles that can’t connect to it are removed, and clicking one of the rest snaps the two bricks together by those studs. A small data table decides which stud types can connect to which.

A handle on every stud, top and bottom.
Two white bricks in Unreal. The upper one is selected with a move gizmo on one of its studs, and the lower one shows small green diamond markers on its top studs where the selected stud can attach
Where the selected stud can attach.

Toggles and save state

Once the MVP worked, I had the tool playtested and used the feedback to decide what to change next. Testers wanted to place bricks off the grid and snap them together by their studs, see which colour they had selected, have the tool remember its state, and get more categories to search by. Most of this section came out of that round.

Four toggles above the part list switch the main behaviours on and off: recolouring selected bricks, grid snapping, selecting studs and snapping by studs. The widget also saves its state to JSON, so closing the editor doesn’t reset everything.

The row of four toggle buttons above the part list, a water drop, a dotted grid, a stud and a snapping icon, with a tooltip reading Toggle selected bricks changing colour when new colour selected
The four toggles, with one of their tooltips.
The Unreal editor with the Tool Brick panel on the left showing the search 2 x 4 in the Brick category, a white 2 x 4 brick selected on a green baseplate with yellow handles on its studs, and the details panel on the right listing Part ID 3001, Grid Size 10 10 4, the random offset ranges, Seed and Grid Snapping

Reflections

  • Snap handles as actors - Each handle is its own Blueprint actor attached to the brick, and anything with a lot of studs, like a big baseplate, gets laggy to move. Turning stud points off stops the lag, but the proper fix is moving the handles inside the brick as components.
  • No Nanite for translucent parts - Nanite doesn’t support translucent materials, so transparent colours cost more than solid ones and are best used sparingly in a big build. Traditional LODs for them are the likely fix.
  • The limits of Blueprint - In C++, bricks wouldn’t need a Blueprint just to hold their instanced mesh, the tool could read the mouse position for proper drag and drop, and the JSON could be read back efficiently.

There are a few small bugs too, like an unnecessary warning when you delete a brick while its handles are showing, and part tiles without a thumbnail sometimes picking up the colour tint when you scroll.

Sources