Checking how many agents are working

How this works
Contact
← Blog
A cinematic photograph of a matte ceramic apple on a sculptor's turntable beside a flat printed photo of the same apple, in teal and steel with a warm amber light, the AMARBARO mark and wordmark centered over it.
✎article de blog

From one picture to a 3D object

The short version

A model such as TRELLIS.2 can turn one picture into a textured 3D mesh, and for a game the largest time savings came from sizing the settings to the game and fixing a thread-spinning math library, not from a faster graphics card.

What this is about

A photo is flat. A 3D object is something you can walk around. There are AI models that look at one picture of an apple and build a 3D shape and a surface to match. We use one, called TRELLIS.2, inside ComfyUI, to make props for a game: an apple, a crate, a tea cup.

This article shows the steps, why our first run took 325 seconds, and how we sped it up. Then it shows the other half of the job: how to check thousands of 3D files without opening each one.

Why it matters

A 3D shop or game needs lots of objects. Modeling each by hand takes a person hours. If a model can make a decent prop in about a minute, you can fill a room quickly. But a fast prop is only useful if it is good, and checking costs time too.

How it works

In plain words:

  1. Start with one picture of the object, usually made by an image model. See How AI makes a picture from words.
  2. Build the shape. Three loops ("samplers") refine the shape step by step: the rough shape, the structure and the texture.
  3. Make the mesh. A mesh is the object as a net of small triangles. Several steps tidy it: remesh, decimate (cut triangles), unwrap (flatten the surface so a picture can be painted on it).
  4. Bake the texture. Paint color and shading onto the surface.
  5. Save as a GLB file, a common 3D format.

The game wanted about 8,000 triangles and a 1024 pixel texture. The ready-made workflow aimed higher, which is where the time went.

How the time came down

Machine noise first. Our graphics card was often busy with other jobs. One asset took 115 to 245 seconds under load and 94 to 102 on an idle box. So every time below is an upper bound, and a full job comparison on this box has about plus or minus 9 percent noise.

Cut 1: size the settings for the game. The template aimed at film quality: 1536 upsampling, 4096 textures, 64 light samples, 700,000 polygons. We set 1024 for upsampling and texture, 16 light samples and a smaller mesh. At the upsample step, the apple went from 43,020 tokens to 19,004, and the step time from 20.3 seconds to 4.1. The reason is that the cost of attention grows with the square of the number of tokens. Result: 325 s to 128 s on a cold server. A batch of 10 food props averaged 142 s against 217 s before. All 15 meshes passed our checker.

Cut 2: a math library that spun. Under load the GPU was only 5 percent busy while the server used 366 percent of CPU. We pointed our CPU sampler, corewait, at the live server. 96.5 percent of its CPU was inside OpenBLAS, a math library bundled with numpy. About half was threads spinning in locks, waiting for the next tiny job. The real math was 0.2 percent. The fix was one setting, OPENBLAS_NUM_THREADS=1. The apple at the template's size went from 320 s to 96 s. Our first guess the day before had been wrong, and the profile corrected it. Try corewait at amarbaro.com/projects/corewait.

The end of our story is in Props from 325 seconds to 84.

What we could not say

We say what the notes say. One older arm with fewer steps was fast but lost 42 to 59 percent of texture sharpness on one prop. A later note says the steps between 0.5 and 0.75 were noise for time on four props. So the quality claim rests on one prop.

Checking thousands of 3D files

Once you have a library, you cannot open every file. We make a small 200 pixel preview picture of each, using six Blender workers in parallel. The run made 3,884 pictures in 293.9 seconds. Six workers were 8 percent faster than a one-worker pilot (13.2 against 12.2 pictures per second) and used 6 percent more energy per picture (4.99 against 4.70 joules). The figures have no spread recorded, so the gap may be partly noise.

The library held 3,972 assets: 2,853 3D files and 1,119 Blender files. 84 ended without a thumbnail. Thirty failed with "no visible mesh-like object", which is a clear reason. Fifty-three failed with no reason recorded, and we say so. Each thumbnail is saved under the hash of its source file, so a rerun skips what is done.

A preview also lies sometimes. In a later check, 74 percent of the 3D and Blender previews in the store were gray boxes. They turned out to be our 200 pixel store previews, not the real files. Three signals worked on a preview: the share of flat pixels, of inner edges and the color saturation. The picture is the evidence, so look at the sheet, at the size the viewer will see.

Words you may meet

  • Mesh: a 3D shape made of triangles.
  • Texture: the picture painted on the surface.
  • GLB: a single file holding a 3D model.
  • Sampler: a loop that refines a result step by step.
  • Token: a small piece of the picture the model reads.
  • Thumbnail: a small preview picture.

Try it

  1. Take a photo of a small object on a plain table and look at it. Think about what a model must guess: its back, its underside.
  2. Walk the 3D shop at aiazic.com and look at the props. Turn them around.
  3. Read Six shards made the 3D thumbnail run 8 percent faster for the full record of the preview run.

What we do not claim

The times are from one card, often loaded. We have not measured how a single resident Blender process would compare with six workers, and the plan asked for exactly that.

Commentaires

Pas encore de commentaires.

Se connecter pour commenter.