Blog · · 8 min to read
Triangles too thin to paint
Objects model-maker made had thin dark strokes on their paint. They came from triangles thinner than one pixel of the texture, which got no colour and showed its black background. A fix took the strokes on 128 stored models from 29,416 to 1,141 and shipped in model-maker 0.3.2.
The last post was about a fix we stopped. This one is about a fix that shipped. Objects made by model-maker had short, thin dark strokes on their paint: specks on a clay jug, slashes across a stone rim. They were not in the paint. They came from the very last step, called baking.
Four words first
Triangles. A 3-D object on a computer is a skin of small flat triangles, joined edge to edge. model-maker's objects have up to about 60,000 of them. Most are a fair size, but some are slivers: long and very thin, like a needle.
Texture. The colour of the object is kept in one square picture, the texture. Imagine peeling the skin off the object, cutting it into pieces and laying them flat on that picture, like a sewing pattern on cloth. That arrangement is the layout. Each triangle then has its own place on the texture, and a viewer that draws the triangle reads its colour from there.
Texel. One small square of the texture: its pixel. model-maker's textures are 2,048 texels a side, about 4 million texels in all. Each texel holds one colour.
Baking. model-maker paints the object as pictures seen from several sides. Baking copies those colours onto the texture, once, so the finished file needs only the texture. Before the bake, every texel is black. The bake goes through the texels and asks: which triangle holds this texel's centre? That texel takes that triangle's colour. Texels just round each piece take its colour too, a few texels deep. Everything else stays black, but no triangle ever reads there, so it does not matter.
What went wrong
A sliver can be thinner than one texel. Then it may lie between the texels' centres and hold none of them. No texel takes its colour.
That alone would be fine if the sliver sat inside a bigger piece. But the layout groups triangles by the way they face, and a sliver often seems to face another way than the surface round it. So it becomes a tiny piece of its own, alone on the black. On a fox, 1,402 of its 1,737 pieces were a single triangle.
When a viewer draws the object, the sliver reads its colour from its own place on the texture, and finds black. On the object you see a short thin dark line.

How we found it
Before fixing anything, we checked it was not the paint. Where the strokes showed, the paint itself was light. Baking the stored files again gave the very same strokes. Giving those triangles their neighbours' colour made them disappear. So the fault was in the bake, and every one of the 128 models we had stored had it.
The fix
Two steps, both common in programs that bake textures:
- A thin triangle colours what it touches. If a triangle holds no texel centre, the bake walks along its three edges in half-texel steps. Every texel it touches that no other triangle holds takes the thin triangle's own colour.
- No black is left. After that, every texel still empty takes the colour of the nearest coloured texel, however far. Then even a smaller copy of the texture, made for a web viewer, has no black to mix in.
Nothing else changes: the triangles, the layout, and every texel a triangle already held stay exactly as they were. The bake takes about 5 % longer.

How we measured it
We wrote the bars first, the results the fix had to reach, together with the programs that count. Both were locked before any texture of the fixed bake existed, so nothing could be bent to fit.
A dark stroke counted when a thin triangle reads clearly darker than the surface round it and is long enough to see. On 128 stored models (85 animals and 20 objects from our tests, and the 23 examples in Model Maker Studio):
- Dark strokes: 29,416 before, 1,141 after, down 96 %.
- Models with 100 or more strokes: 103 before, 0 after.
- Five places we had kept hidden until the end, each with 31 to 60 strokes: 0 after, on all five.
- Two judges, blind, shown each pair with the sides shuffled, picked the "after" side as the one with fewer marks on all 10 models with strokes, and "before" on none.
There were eight bars in all. Five passed. Three failed as written; they are in the next section.

What it does not fix
Thin pale lines stay. About 19 a model now, against about 16 before the fix: thin triangles that read a lighter colour than the paint round them. They are the next thing to fix.
Three bars failed as written, and stay failed. We do not reword a bar into a pass after the fact. Beside each, what we found:
- Strokes gone: the 96 % passed, but the counting program also found 1,389 triangles reading pure black and 15 with no texel of their own. The black is black paint on dark models: the bake's own record shows no empty texel left on any model. Of the 15 triangles, 13 do have texels, just not at the four points the program reads. 2 really have none, both on one model; they read a neighbour's colour, not black.
- No new colour: pale slivers went up, from 2,048 to 2,467. Of the 515 newly pale ones, 434 showed a dark stroke or black before: the black had been hiding an older fault. Truly new: 81, against 96 that are no longer pale.
- Nothing else changed: the program saw 275 texels change. It worked out the layout from rounded numbers, while the bake uses exact ones, so a texel centre lying exactly on an edge counted in one and not in the other. Worked out the bake's own way, not one held texel changed on any of the 105 models baked again.
Tested on both cards, then shipped
We test model-maker on two graphics cards, one with 16 GB of memory and one with 12 GB. Each had a stored run of 48 painted objects. The fix touches only the bake, which runs on the processor after the card's work is done, so we baked both runs again on the processor: once with the old version, twice with the new one.
- No object changed its result. On each card 34 of 48 passed every check, before and after.
- Everything but the texture stayed the same, on all 48, and the new version run twice gave the same files both times. Worked out from the file's rounded numbers, 129 and 168 of about 60 million held texels differed, every one on the edge of a piece: most likely the same rounding as above, but on these objects we did not check it the bake's own way.
- One thing moved: the question judge, the AI that looks at the finished object and says how sure it is that it shows what was asked, on a scale from 0 to 1. Its answer moved on every object, because every texture changed. Mostly by about 0.01; the most, a war axe, from 0.81 to 0.69, still a pass. None crossed the pass line at 0.5. The moves went the same way on the two cards for only 26 of the 48 objects, so the judge reacts to small changes in the picture; the fix does not push it one way.
The fix shipped in model-maker 0.3.2 on 25 November. Objects you make now come out with almost none of the strokes. An object made before can be baked again from its saved folder with ./model-maker finish, and a finished .glb file (the 3-D file model-maker writes) alone can be mended with ./model-maker repair-texture.
Words used
- Triangle: one of the small flat pieces that make up an object's skin. A sliver is a very thin one.
- Texture: the square picture that holds an object's colours, its skin laid out flat in pieces.
- Texel: one small square of the texture, holding one colour.
- Baking: copying the paint onto the texture, once, at the end.
- Bar: the result a change must reach to count as working, written down before it runs.
- Blind: judged without knowing which side is which.