#7053·openscad

Changing the color scheme does not recolor an already-rendered model

Author: whosawhatsisCreated Sep 18, 2026Updated Sep 18, 2026

Switching to a different color scheme repaints the background but leaves the rendered model in the old scheme's colors. The model only picks up the new scheme when its geometry is computed again — editing the source, or anything else that forces a fresh F6.

Reproduced on current master (033ddb6f6), Linux, Qt6, Manifold backend, NVIDIA GPU. Not platform-specific as far as I can tell — the cause is in shared code.

Steps to reproduce

  1. Open this model:
scad
difference() {
  cube(20, center = true);
  cylinder(h = 40, r = 6, center = true, $fn = 32);
}
translate([25, 0, 0]) color("red") cube(10, center = true);
  1. Render it with F6 under Cornfield.
  2. Preferences → 3D View → Color scheme → Metallic.

Expected: the model is drawn in Metallic's colors. Actual: the background turns blue, the model stays Cornfield yellow.

What it looks like

F6 render under Cornfield:

Rendered under Cornfield

After switching to Metallic — background changed, model did not:

After switching to Metallic on master

Sampling the two frames makes it precise. The face colors are bit-for-bit the same before and after; only the background differs:

background model faces
Cornfield #ffffe5 #fad82c, #8f7b19, #a58f1d
after switching to Metallic #aaaaff #fad82c, #8f7b19, #a58f1d (unchanged)

The explicitly color("red") cube stays red throughout, which is correct — that color comes from the model, not the scheme.

For comparison, this is the same switch with the two causes below fixed, where the faces do follow the scheme (and the red cube still doesn't):

After switching to Metallic, fixed

Cause

Two independent things have to go right, and neither does:

  1. The scheme is baked into cached geometry. ManifoldGeometry::toPolySet() resolves CGAL_FACE_FRONT_COLOR / CGAL_FACE_BACK_COLOR from RenderSettings::inst()->colorscheme and stores the resulting colors in the PolySet. That PolySet goes into the geometry cache and is reused; MainWindow::setColorScheme() does not invalidate it. So the cached geometry permanently carries the colors of whichever scheme was active when it was built.

  2. The vertex buffers are never rebuilt. Each renderer's prepare() builds its VertexStateContainers only when they are empty, and setColorScheme() only refreshes colormap_. Per-vertex colors are baked into the VBOs at build time, so even geometry that carried no scheme colors would keep its uploaded ones.

Fixing either alone changes nothing visible: with (1) fixed the renderer still redraws stale buffers, and with (2) fixed the rebuild re-reads the baked colors out of the cached PolySet.

The scad file and the full-resolution captures are here.

I have a fix for both and will open a PR shortly.