[Enhancement] Chess: user-generated piece models via Trellis3D pipeline #71

Closed
opened 2026-05-05 20:19:56 +00:00 by spikerj · 1 comment
Owner

Summary

Allow users to generate custom 3D chess piece models using the existing Trellis3D (image → GLB) pipeline and use them in place of the default static piece set.

Depends on

  • #40 — Chess Three.js display must land first; it introduces the ChessPieceModelProvider injection token abstraction that this feature plugs into.

Background

The chess 3D renderer (#40) introduces a ChessPieceModelProvider interface with an InjectionToken. The default StaticChessPieceModelProvider loads GLTF models from local assets. This ticket adds a second provider implementation — Trellis3dChessPieceModelProvider — that loads user-generated GLB models from the Trellis3D backend via ThreeDGeneratorService.getDownloadUrl().

The Trellis3D pipeline already supports:

  • Image upload → RabbitMQ → TRELLIS worker → GLB output
  • GET /api/threedmodel/{id}/download (authenticated, streams GLB)
  • ThreeDGeneratorService on the Angular side with GLTFLoader consumption

Scope

New: "Piece Set" concept

  • A piece set is a collection of 6 ThreeDModel IDs (one per piece type: king, queen, rook, bishop, knight, pawn).
  • Users create a piece set by uploading 6 images (one per piece type) or optionally via text prompts (requires extending SourceType.Text in the Trellis worker).
  • Piece sets are persisted per user — new Mongo entity or sub-document on user profile.

New: Trellis3dChessPieceModelProvider

  • Implements ChessPieceModelProvider interface from #40.
  • loadPrototype(type, color) calls ThreeDGeneratorService.getDownloadUrl(modelId) → authenticated fetch → blob URL → GLTFLoader.load().
  • Handles color tinting (white/black) on the loaded model's materials.
  • Falls back to StaticChessPieceModelProvider if any model in the set is still generating, failed, or missing.

New: UI for piece set management

  • Chess settings panel gains a "Piece Set" section.
  • Options: Default (static) | Custom (user-generated).
  • Custom flow: upload 6 images, preview each as it generates (real-time progress via existing SignalR Receive3DModelProgress), save set.
  • The component-level providers array swaps CHESS_PIECE_MODEL_PROVIDER based on user selection.

Backend considerations

  • Auth caveat: GLTFLoader (Three.js FileLoader) does not pass Angular HttpClient interceptors. The provider must fetch the GLB as an authenticated blob and create an object URL, or configure a custom Three.js loader with setRequestHeader.
  • Extend ThreeDModel entity if chess-specific metadata is needed (e.g., chessPieceType field).

Acceptance criteria

  • Users can generate a complete custom 6-piece set from uploaded images.
  • Generated pieces render correctly in the 3D chess board with proper scale, orientation, and color tinting.
  • Progress updates display in real-time during generation.
  • Graceful fallback to default pieces if generation is incomplete or fails.
  • Piece set selection persists across sessions.
  • No regression to default static piece set behavior.

References

  • ChessPieceModelProvider interface: introduced in #40
  • Trellis3D service: spikersoft-backend/SpikerSoft.EventHandlers.Trellis3D.Python/
  • Angular service: libraries/tools/src/services/threed-generator/threed-generator.service.ts
  • Backend API: SpikerSoft.Api/Domain/ThreeDModel/ThreeDModelController.cs
## Summary Allow users to generate custom 3D chess piece models using the existing Trellis3D (image → GLB) pipeline and use them in place of the default static piece set. ## Depends on - **#40** — Chess Three.js display must land first; it introduces the `ChessPieceModelProvider` injection token abstraction that this feature plugs into. ## Background The chess 3D renderer (#40) introduces a `ChessPieceModelProvider` interface with an `InjectionToken`. The default `StaticChessPieceModelProvider` loads GLTF models from local assets. This ticket adds a second provider implementation — `Trellis3dChessPieceModelProvider` — that loads user-generated GLB models from the Trellis3D backend via `ThreeDGeneratorService.getDownloadUrl()`. The Trellis3D pipeline already supports: - Image upload → RabbitMQ → TRELLIS worker → GLB output - `GET /api/threedmodel/{id}/download` (authenticated, streams GLB) - `ThreeDGeneratorService` on the Angular side with `GLTFLoader` consumption ## Scope ### New: "Piece Set" concept - A piece set is a collection of 6 `ThreeDModel` IDs (one per piece type: king, queen, rook, bishop, knight, pawn). - Users create a piece set by uploading 6 images (one per piece type) or optionally via text prompts (requires extending `SourceType.Text` in the Trellis worker). - Piece sets are persisted per user — new Mongo entity or sub-document on user profile. ### New: `Trellis3dChessPieceModelProvider` - Implements `ChessPieceModelProvider` interface from #40. - `loadPrototype(type, color)` calls `ThreeDGeneratorService.getDownloadUrl(modelId)` → authenticated fetch → blob URL → `GLTFLoader.load()`. - Handles color tinting (white/black) on the loaded model's materials. - Falls back to `StaticChessPieceModelProvider` if any model in the set is still generating, failed, or missing. ### New: UI for piece set management - Chess settings panel gains a "Piece Set" section. - Options: Default (static) | Custom (user-generated). - Custom flow: upload 6 images, preview each as it generates (real-time progress via existing SignalR `Receive3DModelProgress`), save set. - The component-level `providers` array swaps `CHESS_PIECE_MODEL_PROVIDER` based on user selection. ### Backend considerations - **Auth caveat**: `GLTFLoader` (Three.js `FileLoader`) does not pass Angular `HttpClient` interceptors. The provider must fetch the GLB as an authenticated blob and create an object URL, or configure a custom Three.js loader with `setRequestHeader`. - Extend `ThreeDModel` entity if chess-specific metadata is needed (e.g., `chessPieceType` field). ## Acceptance criteria - [ ] Users can generate a complete custom 6-piece set from uploaded images. - [ ] Generated pieces render correctly in the 3D chess board with proper scale, orientation, and color tinting. - [ ] Progress updates display in real-time during generation. - [ ] Graceful fallback to default pieces if generation is incomplete or fails. - [ ] Piece set selection persists across sessions. - [ ] No regression to default static piece set behavior. ## References - `ChessPieceModelProvider` interface: introduced in #40 - Trellis3D service: `spikersoft-backend/SpikerSoft.EventHandlers.Trellis3D.Python/` - Angular service: `libraries/tools/src/services/threed-generator/threed-generator.service.ts` - Backend API: `SpikerSoft.Api/Domain/ThreeDModel/ThreeDModelController.cs`
Author
Owner

Migrated as part of the umbrella-tracker breakup.

This ticket needed changes in more than one repo, so it became one issue per repo:

Verified 2026-08-07 against spikersoft-angular@8e5a4048 and spikersoft-backend@98102023: dependency #40 landed (ChessPieceModelProvider + CHESS_PIECE_MODEL_PROVIDER token + StaticChessPieceModelProvider are on master), but Trellis3dChessPieceModelProvider exists only as a code comment, the options modal is a documented placeholder, and there is no backend piece-set entity or generic user-settings store.

Status: not started — unblocked (#40 shipped the provider abstraction); needs the provider + UI in Angular and piece-set persistence in the backend.

Closing here. Work now lives in the repo that holds the fix, so fixes #<N> in a PR will
auto-close it on merge. The umbrella tracker keeps cross-repo epics only.

— Opus 5 Agent

Migrated as part of the umbrella-tracker breakup. This ticket needed changes in more than one repo, so it became one issue per repo: - Backend: spikerj/spikersoft-backend#578 - Angular: spikerj/spikersoft-angular#691 Verified 2026-08-07 against `spikersoft-angular@8e5a4048` and `spikersoft-backend@98102023`: dependency #40 landed (`ChessPieceModelProvider` + `CHESS_PIECE_MODEL_PROVIDER` token + `StaticChessPieceModelProvider` are on master), but `Trellis3dChessPieceModelProvider` exists only as a code comment, the options modal is a documented placeholder, and there is no backend piece-set entity or generic user-settings store. Status: not started — unblocked (#40 shipped the provider abstraction); needs the provider + UI in Angular and piece-set persistence in the backend. Closing here. Work now lives in the repo that holds the fix, so `fixes #<N>` in a PR will auto-close it on merge. The umbrella tracker keeps cross-repo epics only. — Opus 5 Agent
Sign in to join this conversation.