Skip to content

Painted Shader fixes: stop bleeding Devices state, restore its own look - #84

Merged
quefreen merged 1 commit into
mainfrom
3D
Sep 21, 2026
Merged

quefreen merged 1 commit into
mainfrom
3D

Conversation

@quefreen

Copy link
Copy Markdown
Collaborator

Nav rail:

  • Drop the collapsible Experiments group; 3D and Web (Boards stays gated off entirely, see below) list directly in the main rail instead of behind a submenu.
  • Remove Board from the rail and from the route entirely: BoardStage can crash (composedPoseLayers reads values.offset before it's merged) when the scene has no active track, so it stays closed everywhere rather than half-shipped.
  • Add a GitHub link to the rail, between Docs and the theme toggle.
  • Rename nav labels: Mockup -> Devices, 3D -> OBJ.

Painted Shader (three3d/cartoon.ts):

  • Fix a real bug: a CSS class shared with the 2D canvas's PNG- transparency checkerboard (.stage-canvas, !important) was clobbering the 3D stage's own inline background-fill style, so the checkerboard rendered as a permanent overlay regardless of the chosen Background Fill. Split it into its own .stage-transparency- checker class, applied only where a canvas draws opaque pixels over it.
  • Fix real cross-contamination with Devices: background/sun state (bgFill, bgTexAmount/Scale, sunIntensity/Shadow, sunMask + transform) lived in one shared use3DStore slot read by both effects. Tuning Devices' studio backdrop silently retuned the Painted Shader's too, and opening a Mockup project overwrote it outright. Scoped per effect id (environments: Record<effectId, Environment>), same pattern already used for the model transform, with its own dark moody default for the Painted Shader vs. Devices' bright studio one, and a migration path for blobs persisted before the split.
  • Fix another real bug: cartoon.ts called apply3DAnimation() - Devices' 16-preset camera/lighting choreography - reading use3DStore's mockupAnimation/mockupSpeed. Even at the 'static' default this silently overrode the camera's fov every frame: (42 instead of 45), and any non-static preset left over from a Devices session hijacked the orbit camera entirely. Removed; the Painted Shader now only ever drives its own free-orbit camera.
  • Retune the default look: Key Light 2.6 -> 0.3, Ambient 0.5 -> 0.1, and drop the ACESFilmicToneMapping added mid-session to tame blown highlights - its filmic curve lifts shadows/midtones too, reading as a wash over the whole scene; the actual fix was the cross-contaminated background above. NoToneMapping (the default) is what the scene was designed against.
  • Center the model by default: DEF_OFFSET fought fitAndCenter's own bbox-centering with a stale (-0.8, 0.7) nudge. Zeroed, so an untouched model (and "Center model") land on the canvas's true centre in any viewport.
  • Drop the timeline for this section: nothing advances its clock on its own (it's a still, not a played clip), so Timeline gained a showScrubber prop to hide the play/scrubber/duration/layers row for it. Export itself is also hidden for now (no export defined for this scene yet), and the now-empty footer collapses via a new .app-3d layout class instead of leaving a dead bar on screen.

Nav rail:
- Drop the collapsible Experiments group; 3D and Web (Boards stays
  gated off entirely, see below) list directly in the main rail
  instead of behind a submenu.
- Remove Board from the rail and from the route entirely: BoardStage
  can crash (composedPoseLayers reads values.offset before it's
  merged) when the scene has no active track, so it stays closed
  everywhere rather than half-shipped.
- Add a GitHub link to the rail, between Docs and the theme toggle.
- Rename nav labels: Mockup -> Devices, 3D -> OBJ.

Painted Shader (three3d/cartoon.ts):
- Fix a real bug: a CSS class shared with the 2D canvas's PNG-
  transparency checkerboard (`.stage-canvas`, `!important`) was
  clobbering the 3D stage's own inline background-fill style, so the
  checkerboard rendered as a permanent overlay regardless of the
  chosen Background Fill. Split it into its own `.stage-transparency-
  checker` class, applied only where a canvas draws opaque pixels
  over it.
- Fix real cross-contamination with Devices: background/sun state
  (bgFill, bgTexAmount/Scale, sunIntensity/Shadow, sunMask + transform)
  lived in one shared use3DStore slot read by both effects. Tuning
  Devices' studio backdrop silently retuned the Painted Shader's too,
  and opening a Mockup project overwrote it outright. Scoped per
  effect id (`environments: Record<effectId, Environment>`), same
  pattern already used for the model transform, with its own dark
  moody default for the Painted Shader vs. Devices' bright studio one,
  and a migration path for blobs persisted before the split.
- Fix another real bug: cartoon.ts called apply3DAnimation() -
  Devices' 16-preset camera/lighting choreography - reading
  use3DStore's mockupAnimation/mockupSpeed. Even at the 'static'
  default this silently overrode the camera's fov every frame: (42
  instead of 45), and any non-static preset left over from a Devices
  session hijacked the orbit camera entirely. Removed; the Painted
  Shader now only ever drives its own free-orbit camera.
- Retune the default look: Key Light 2.6 -> 0.3, Ambient 0.5 -> 0.1,
  and drop the ACESFilmicToneMapping added mid-session to tame
  blown highlights - its filmic curve lifts shadows/midtones too,
  reading as a wash over the whole scene; the actual fix was the
  cross-contaminated background above. NoToneMapping (the default)
  is what the scene was designed against.
- Center the model by default: DEF_OFFSET fought fitAndCenter's own
  bbox-centering with a stale (-0.8, 0.7) nudge. Zeroed, so an
  untouched model (and "Center model") land on the canvas's true
  centre in any viewport.
- Drop the timeline for this section: nothing advances its clock on
  its own (it's a still, not a played clip), so Timeline gained a
  `showScrubber` prop to hide the play/scrubber/duration/layers row
  for it. Export itself is also hidden for now (no export defined for
  this scene yet), and the now-empty footer collapses via a new
  `.app-3d` layout class instead of leaving a dead bar on screen.
@quefreen
quefreen merged commit a8f9fd4 into main Sep 21, 2026
1 check passed
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.

2 participants