Skip to content

Share viewer / bake: images painted from project files are missing from lod0.glb (surfaces render white) #1296

Open

Description

@fmay-lmwr

What happened?

Images applied to an item slot with a native material texture pointing at a project file (.../storage/v1/object/public/project-assets/<project>/files/<asset>/<name>.png|jpg) render correctly in the editor, but they are missing from the published bake. In the share link (/s/pvg_… → /viewer/<project>), those surfaces are plain white. They sometimes appear on the very first load (most likely from the browser cache) and disappear on reload.

Inspecting the baked project-bakes/<project>/<hash>/lod0.glb: the item nodes are there, but the painted primitive has baseColorFactor [1,1,1,1] and no baseColorTexture at all. Catalog items in the same GLB keep their textures (KTX2), so texture handling works in general, just not for project-file textures.

Where I think it breaks

From the public code, the client side looks correct:

  • BakeExporter exports with textures: 'reference' (packages/editor/src/components/editor/bake-exporter.tsx).
  • getTexture() in packages/viewer/src/lib/materials.ts stamps project-file textures as kind: 'project-asset'.
  • replaceReferencedTextures() in packages/editor/src/lib/glb-export.ts swaps them for a 1×1 placeholder that carries extras.pascalTextureRef.
  • GlbScene (packages/viewer/src/components/viewer/glb-scene.tsx) does not resolve pascalTextureRef itself.

So the step that turns placeholders back into real textures happens in the hosted bake pipeline. That pipeline seems to resolve item-glb / library-material refs but drops project-asset ones. Since the final GLB has no texture at all on these primitives (not even the placeholder), the reference is probably stripped rather than left unresolved.

One other possibility worth ruling out: if storageUrl is unset or different in the bake worker, stampPascalTextureRef returns null. In that case the texture would be embedded only if its image had finished loading by capture time (materialTextureLoadState()).

Steps to reproduce

  1. Upload an image to the project files (upload_project_file, or from the editor).
  2. Create an authored item with a PlaneGeometry mesh whose material is named slot_print.
  3. paint the item, role print, with { properties: { color: '#ffffff' }, texture: { url: '<public project-assets URL of the image>' } }.
  4. The image shows in the editor (view_scene confirms it).
  5. Save a checkpoint, publish it, and open a share link. The surface is white. Download lod0.glb: there is no baseColorTexture on that primitive.

Example (live): project project_bGCQgwm3yZkaidS1. The items are the shop sign item_zjui4njgl840ssom and three hanging posters, item_qgte22uxdntaqs7d, item_bf808zemjfqevntf and item_y5q4szowjejepe1s, all with project-assets textures.

Expected behavior

The bake and the share viewer show project-file textures, as the editor does. The same should hold for catalog textures.

Browser & OS

Chrome (stable), macOS 15.

Additional context

  • Workaround that does survive the bake: rebuilding the image as per-colour meshes (one plain material per colour, max 29 colours to stay under the 32-material limit). It works, but the result is visibly pixelated.
  • On the same projects, the viewer also gets HTTP 404 on 7 /api/projects/<project>/artifacts/<hash> requests (catalog plants, Back-to-wall toilet, Wall-hung basin), on first load and on reload. This may be unrelated.

Activity

  1. Aymericr commented on Nov 22, 2026

    @Aymericr
    Member

    Thanks for the report @fmay-lmwr. The share-viewer bake runs in our hosted pipeline, which isn't part of this repository, so there's no code here to fix it in. I've flagged it to the team. If you can share a scene ID (or a minimal project) where the painted images go missing, that will make it quicker to track down.

  2. added
    bug
    on Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions