Skip to content

Bake laser engraving into the 3D stock (flat and rotary) - #361

Open
knipknap wants to merge 5 commits into
mainfrom
feat/material-fold-pipeline
Open

Bake laser engraving into the 3D stock (flat and rotary)#361
knipknap wants to merge 5 commits into
mainfrom
feat/material-fold-pipeline

Conversation

@knipknap

@knipknap knipknap commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Laser engraving is no longer shown as floating preview quads in the
3D view — it is now baked into the stock itself as persistent
charring, for flat and rotary (cylindrical) stock.

  • Material fold compute nodes: one MaterialFold node per visible
    stock item (and per rotary layer), folding upstream raster/vector
    material effects into a raygeo MaterialState with a burn surface
    map. Nodes are keyed stock:{uid} with deterministic version
    tokens; results flow through a new MaterialStateArtifact and
    resolve to stock items as well as layers.
  • Flat burn-in: the stock compiler maps the surface map onto prism
    vertices via power UVs; the stock shader renders a power-keyed
    scorch→char→ash color ramp with roughness shift and a heat halo on
    top-facing surfaces.
  • Rotary burn-in: rotary layers emit folds against a raygeo
    CylinderStock over the unrolled axial × circumference domain
    (centered on the machine origin). The cylinder shell duplicates its
    seam at the bottom so power UVs never cross the texture cut, and the
    shader burns lateral faces only (uRotary guard on local normals).
  • LUT suppression: texture quads covered by a burned stock are
    skipped (flat and rotary); mutually exclusive stock/underlay
    visibility replaces the LUT overlay debug toggle.
  • Stock visibility toggle now appears for docs whose stock lives
    in rotary layers, and hides/shows the solid cylinder.
  • Dependency: raygeo 1.45.0 (cylindrical fold support).

Test plan

  • New unit tests: fold-node emission/keys/tokens (flat + rotary),
    layer-keyed state dispatch, presenter spec attachment + refresh,
    rotary compile with power UVs/seam/AABB, scene-compiler suppression,
    overlay toggle behavior.
  • End-to-end: rotary doc runs through execute_stages producing a
    cylindrical state with a surface map; offscreen EGL render of the
    real StockRenderer shows the burned region darkening by ~98
    brightness units.
  • Full backend suite (446 simulator/pipeline tests) and lint/pyright
    clean.

Laser raster and vector ops now char the stock in the 3D preview
instead of floating preview quads: the material fold emits a burn
surface map, the stock compiler maps it onto prism vertices via
power UVs, and the stock shader renders a power-keyed scorch ramp
with a heat halo on top-facing surfaces. Texture layers covered by
a visible stock's burn are suppressed, the show_lut_overlay toggle
is removed in favor of mutually exclusive stock/underlay visibility,
and the dependency is bumped to raygeo 1.44.0.
Rotary layers now char their cylindrical stock like flat stock does:
the intent builder emits a material fold per rotary layer against a
raygeo CylinderStock over the unrolled axial x circumference domain
(centered on the machine origin), keyed stock:{layer.uid}; material
states resolve to layers as well as stock items. The cylinder shell
duplicates its seam at the bottom so power UVs span the unrolled
domain without crossing the texture cut, and the shader burns lateral
faces only via a uRotary guard on local normals.

Also: rotary LUT quads are suppressed when a burn map covers them,
the wireframe cylinder stays hidden while a layer's solid rotary
stock is visible, the stock visibility toggle now covers rotary
layers, and the dependency is bumped to raygeo 1.45.0.
The material manager now owns default-material resolution: it prefers
the user-configured default (new config setting), then oak from any
registered library, then a bundled oak shipped under
rayforge/resources/materials/ that is never registered as a library
and thus invisible in the material manager UI.

New stock assets and layers get the configured default material and
thickness at creation time (stock_cmd/layer_cmd). The 3D scene
presenter falls back to the default material for flat and rotary
stock, the wireframe cylinder placeholder is removed, and the 2D
canvas resolves the default when a stock's material cannot be
resolved. The materials settings page gains a New Stock Defaults
group with a default material selector and thickness row.
All materials are now tintable by default: a material is tinted when
its color is set and untinted (texture shown as-is) when it is None.
The tintable field, its UI switch, and the per-renderer gates are
removed, and the color tag is dropped from all built-in material
definitions since every material ships with a texture. The stock
properties color row is always available. Website docs updated in all
languages.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant