Product mockup renderer for LZX Housing and LZX Stackup projects
Find a file
2026-11-22 12:23:35 -08:00
docs Resolve Housing and Stackup sources into studio shots for the first release. 2026-10-02 13:12:05 -07:00
lzxmockup Illuminated key caps: a keycap: finish (translucent moulding: subsurface + a little transmission), materials tagged lzx_finish, and the lamp rig lights a cap through its moulding with a hot spot in its own colour (Lars: renders must show the caps' colours, translucency and that they light) 2026-11-22 12:23:35 -08:00
runtime Illuminated key caps: a keycap: finish (translucent moulding: subsurface + a little transmission), materials tagged lzx_finish, and the lamp rig lights a cap through its moulding with a hot spot in its own colour (Lars: renders must show the caps' colours, translucency and that they light) 2026-11-22 12:23:35 -08:00
schema Desk work left by the archived sessions, committed in the 2026-10-25 sweep. 2026-10-25 18:30:36 -07:00
scripts Scaffold the LZX Mockup shell for studio photography renders. 2026-09-30 13:47:33 -07:00
tests Linked boards seat per source: a board linked from several sources (the four Team Video cores on TV-CORE-PCB, a control board in its module and its desktop) is labelled with its source's "<n>. " and matches only that source's Stackup board, instead of all of them 2026-11-21 17:58:27 -08:00
.gitignore Resolve Housing and Stackup sources into studio shots for the first release. 2026-10-02 13:12:05 -07:00
CHANGELOG.md Desk work left by the archived sessions, committed in the 2026-10-25 sweep. 2026-10-25 18:30:36 -07:00
lzx-mockup.spec Desk work left by the archived sessions, committed in the 2026-10-25 sweep. 2026-10-25 18:30:36 -07:00
pyproject.toml Merge origin/main (product plates, GPU-only Cycles) with the desk's rig work (per-file views, mask colours, whole-file render swaps). 2026-10-25 20:50:50 -07:00
README.md Board import no longer leans on Blender's extensions folder: pcb2blender's SVG rasteriser reads skia 138's pixels as an RGBA array (no Image.toByteArray there; its PNG encode came back empty), skia-python and Pillow are listed for the rig's blender-site, and compose drops a Pillow loaded from elsewhere so its lazy plugins come from the rig's site. Blender re-syncs the pcb3d_importer extension's wheels at start-up and emptied that folder under a running render on 2026-10-27: every board stayed a plain solid. 2026-10-27 16:51:14 -07:00
run.py Scaffold the LZX Mockup shell for studio photography renders. 2026-09-30 13:47:33 -07:00

LZX Mockup

Product mockup renderer for LZX Housing and LZX Stackup. A mockup file stores source paths only: a Housing .lzx_housing, a Stackup .lzx_stackup, a linked FreeCAD .FCStd, or a linked KiCad .kicad_pcb. Geometry and finishes are read from those sources at render time. A Stackup board linked to an LZX Designer project is exported with lzx-designer-cli (pcb export glb) and drawn in place of the green outline. Shots use the same studio photography rig as the monorepo (lib/lib-kicad/scripts/lzx_product/blender), vendored under runtime/pipeline/rig/.

The application shell matches Housing and Stackup: a .lzx_mockup project file, schema / regen, a PySide6 editor, and the LZX dark theme from data/brand/.

Run

pip install -e . -e ../lzx-housing -e ../lzx-stackup
python run.py
python run.py open path/to/case.lzx_housing -o mockup.lzx_mockup
python run.py open path/to/project.lzx_stackup --mockup mockup.lzx_mockup
python run.py render mockup.lzx_mockup -o out
python run.py render mockup.lzx_mockup --draft --run
python run.py render mockup.lzx_mockup --product --run -o photos

render prints the Blender command. --run starts it.

--product writes website plates: the front three-quarter (product shot), fitted whole into a 1:1 square with a transparent background. A Housing source is rendered three times, as natural aluminum, matte black powder coat, and black anodize. The saved design is not changed. --finishes natural,powder keeps a subset.

Mockup file (version 2)

  • sources: [{ "path", "format" }] — one or more Housing (.lzx_housing) or Stackup (.lzx_stackup) projects, or a FreeCAD part (.FCStd, format freecad-part) or KiCad board (.kicad_pcb, format kicad-pcb) linked the way Stackup links them. arrange is row (shared floor, fronts aligned, gap_mm between them) or manual (each source's x, y, z, yaw).
  • background: transparent (a cutout), studio (the photography sweep stays in frame), or one of the 144 LZX palette names (for example LZX Red), which tints that sweep.
  • shots: catalog shot names, product (front three-quarter on a square canvas), or objects that name a view and set its camera (yaw, pitch, lens, margin, frame, aspect, fstop, ground, transparent). A name that is not in the catalog is rendered from those fields. A new file lists the preview set (hero and the four elevations). An empty list still means the full catalog, which does not include product. A kit (or kit-*) shot lays each Housing source's parts flat and draws one PNG per finish with Housing's renderer. It runs with --run before the Blender pass, needs no Blender, and is never part of the catalog.
  • composite: optional { "columns", "gap", "name" }. After the batch, the frames are laid up in shot order into name.png (a 3-column sheet when columns is 3).
  • studio: optional { "root" }, a studio photography project passed to the pipeline as --studio. Left out when empty.
  • Paths in sources are stored relative to the mockup file when they sit under that folder.

Housing and Stackup are imported from installed packages, or from sibling checkouts ../lzx-housing and ../lzx-stackup when those packages are not installed.

Blender

Put blender.exe in runtime/blender/ so the app is self-contained. Resolution order is that file, then LZX_BLENDER, then an install under Program Files\Blender Foundation. The executable is gitignored.

Render quality

Cycles runs GPU-only (OptiX, CUDA, HIP, Metal or oneAPI, whichever the machine has; the CPU is never ticked alongside it), with adaptive sampling off and OpenImageDenoise on the same GPU. The one quality knob is RENDER_SAMPLES in runtime/pipeline/rig/settings.py, applied to every shot. The pipeline is not tuned per shot, so the count is calibrated against the most demanding shot in the catalog and halved or doubled, never fine-tuned.

To recalibrate: render the hardest shot at the delivered resolution with --samples at the current value and at half of it, and compare the crops (every render prints <shot> render: N samples in S s). Keep the lower count if nothing smears or sparkles. More pixels need fewer samples per pixel, so a calibration done at --scale 0.5 is conservative for the full canvas.

Measured 2026-10-20 on an RTX PRO 2000 laptop GPU, Example VCA hero at --scale 0.5: the GPU-only, non-adaptive rig rendered 256 samples in 26 s where the previous CPU+GPU adaptive rig took 86 s for the same image, and 64 samples took 13 s.

Blender's Python is its own. The compose script also looks in %LOCALAPPDATA%\lzx-mockup\blender-site for the geometry libraries it doesn't ship (shapely, build123d) and for Pillow and skia-python (pcb2blender's SVG rasteriser; never borrowed from Blender's extensions folder, which Blender re-syncs at start-up). Install them with Blender's Python:

& "C:\Program Files\Blender Foundation\Blender 5.1\5.1\python\bin\python.exe" -m pip install --target "$env:LOCALAPPDATA\lzx-mockup\blender-site" shapely build123d fonttools pyclipper jsonschema pillow skia-python==138.0

Layout

Path Role
lzxmockup/model.py Mockup JSON (sources, shots)
lzxmockup/resolve.py Housing / Stackup tessellation and KiCad paths
lzxmockup/kit.py Kit shots: Housing parts laid flat, software-rendered per finish
lzxmockup/render.py Builds the Blender command
lzxmockup/product.py Website plates, one PNG per sheet finish
lzxmockup/crop.py Fit a render into a square
runtime/pipeline/compose.py Blender entry
runtime/pipeline/rig/ Vendored studio rig
lzxmockup/gui/ Branded Qt shell