Commit Graph
24 Commits
Author SHA1 Message Date
chasse20 ca08fb7c3d Merge main and fix symmetry review issues 2026-11-10 20:22:40 -05:00
chasse20 368731f7a4 Fix Clippy checks and clean up affected functions 2026-11-10 05:33:20 -05:00
chasse20 a5f09109ea Merge main into PR 234 2026-11-10 05:33:20 -05:00
Rebornim 74c9afcad9 Renderer: see-through overlay quads drawn after the mesh
Frames carry quads the 3D view draws depth-tested after the mesh (no depth
writes), so the mesh hides them per pixel; used for the symmetry plane, axis
and the line where the plane cuts the mesh.
2026-11-08 01:39:59 +00:00
vangel76 d8ecfb7d42 Merge upstream/main into fix/clippy-chunks-exact-to-as-chunks 2026-11-08 02:27:35 +01:00
Rebornim 284cb7d125 Refuse host paths in files entries for automation
textureSet.meshMap.import takes its paths in files[].path, which
authorize_command did not look at, so a control client could import an
image from outside --read-root. Treat a path or dir in any files entry
like a top-level one, and document that automation imports baked maps
through resource_import plus textureSet.meshMap.set.
2026-11-08 01:25:35 +00:00
chasse20 747068dbdf Fix bake settings and UV tile controls 2026-11-05 22:39:42 -05:00
vangel76andClaude Sonnet 5.5 bc563f504a Fix the remaining Rust 1.99 clippy findings
Use slice fill in the particles test (manual_slice_fill) and
AtomicUsize::try_update, the renamed fetch_update, in the connection
limiter. Both are behaviour-neutral.

Refs #233

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-04 01:40:30 +01:00
bflatastic 92e92ff779 OBJ export writes an MTL material library with each material's maps 2026-11-02 18:20:21 +07:00
Agapenordev b0cd961e90 Merge remote-tracking branch 'origin/main' into fix/import-gpu-oom 2026-11-01 22:23:11 +01:00
AgapenordevandClaude Opus 5.5 098602ec49 Never crash importing meshes with many materials
Every texture set (one per mesh material) allocated full-size display
textures (base color, emissive, ORM, normal, height, aux, with mips) as
soon as it was created: ~130 MB of GPU memory per set at the default
2048 import size. A 16-material OBJ ran a 4 GB laptop GPU out of memory
and wgpu's default error handler panicked, closing the app.

- Display and aux textures start as 1×1 neutral placeholders and get
  their full size with the first non-neutral tile (or aux image), so an
  import costs no GPU memory until its sets are painted.
- That allocation runs in an error scope: on failure the texture keeps
  its placeholder (no retry per tile), the failure is logged and the UI
  shows a toast naming the texture set and the Viewport ▸ Texture
  resolution setting. Painting and export are unaffected.
- The app installs an uncaptured-error handler that logs and reports
  wgpu errors as toasts instead of panicking.
- The GPU path tracer takes each set's size from its largest texture,
  since any kind (base color included) may now be a placeholder.

Tests: 40 sets of 2048 allocate nothing until painted, one painted kind
allocates alone, the aux texture allocates on its first upload, painted
placeholders render, and the GPU tracer matches the CPU with a default
base color beside varying roughness (fails with the old size logic).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 21:05:50 +01:00
AgapenordevandClaude Opus 5.5 836e3f251b Control server: close on malformed JSON before auth
A malformed first line got a "bad JSON" reply but kept the connection open until
the auth deadline, unlike `texturecraft-cli serve` and the documented
one-attempt rule. It now closes the connection while unauthenticated; after
auth a malformed line still only gets the error reply. Adds a regression test
and doc comments on the touched functions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 20:42:06 +01:00
AgapenordevandClaude Opus 5.5 5a065c1e15 Control channel: harden the token file and the app's control server
The desktop app wrote its control token to <temp>/texturecraft-control-<port>.token with
default permissions (world-readable in a shared /tmp), from a hash-based generator, and
compared it non-constant-time with no connection limit. Any local user could read the token
and drive the app, whose command.run takes host paths.

- Token files are created new (remove, then O_EXCL) with mode 0600, so a planted file or
  symlink can neither keep its permissions nor redirect the write; one that cannot be
  replaced disables the server with a hint to set TEXTURECRAFT_CONTROL_TOKEN.
- Clients only read a token file that is a regular file owned by them with no group or
  other permissions, opened without following symlinks or blocking on a FIFO.
- The app's control server uses the shared security module: OS-random 256-bit token,
  constant-time compare, validated and trimmed env token, bounded lines and at most 16
  connections.
- Connections must authenticate within 10 s (AuthDeadline) and get one attempt.
- The app and `serve --port` bind before writing the token file, so a server whose port is
  busy no longer replaces the running server's token.

Regression tests cover owner-only files over an existing open file, symlink and FIFO
handling, the auth deadline, the connection limit and the app's token checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 20:16:37 +01:00
bflatastic 8b8655a6f3 Displacement in the path tracers
Rendering mode traces displaced geometry when the display has displacement on, so path-traced
renders show the viewport's silhouettes and the displaced surface shadows itself.

- render::displace: the viewport's dense subdivision of the mesh, each vertex moved along its
  normal by its set's height (box-filtered to the mip the vertex shader samples) times the
  height strength, at the viewport's scale (world length per UV / 16)
- trace_geometry gives the GPU and CPU tracers the displaced mesh and BVH; Rendering mode,
  texturecraft-cli render --samples and MCP viewport_render use it
- Rendering mode keeps the traced geometry until the mesh, a set's content or a height
  strength changes (display tweaks don't rebuild it)
- subdivide::vertices shared by the renderer's mesh upload and displacement
- test: a uniform height lifts the dense plane by height x strength x world per UV / 16
2026-11-01 13:35:53 +07:00
BFlat 8c428392f0 Merge pull request #8 from storytold/mcp/mesh-file-tools
MCP tools for mesh files: bake_mesh_add, mesh_export, mesh_reimport
2026-10-23 18:16:39 +07:00
BFlat 841921e00d Merge pull request #5 from storytold/formats/external-mesh-files
Meshes with files beside them: .gltf buffers and images, loose USD layer textures
2026-10-23 13:36:53 +07:00
bflatasticandClaude Opus 5.5 1187d0a4c1 MCP tools for mesh files: bake_mesh_add, mesh_export, mesh_reimport
Agents in a workspace can now do everything the file menu and bake panel do with mesh files:
add high polys and the bake cage, export the mesh with its textures, and reimport the
project's mesh. Paths stay below the read and write roots, as for the other workspace tools.

- MCP tools bake_mesh_add {path, cage?}, mesh_export {path, format?} and
  mesh_reimport {path?, preserveStrokes?}; control-channel methods bake.mesh.add, mesh.export
  and mesh.reimport (headless); bridge mode reimports the app's own copy
- engine: Session::add_bake_mesh, Session::mesh_export and Session::reimport_mesh, shared by
  bake.highPoly.add, bake.cage.set, file.exportMesh and file.reimportMesh (the cage now logs
  textures it could not read, like high polys)
- docs/control-protocol.md lists the new tools and methods

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 13:28:56 +07:00
bflatasticandClaude Opus 5.5 9eb200863b Meshes with files beside them: .gltf buffers and images, loose USD layer textures
A .gltf whose buffers or images are separate files, and a loose USD layer whose
UsdPreviewSurface textures sit next to it, now open, reimport and bake as high polys with
those files, and projects keep them: `self_contained_mesh` folds a .gltf's files in as data
URIs and packages a loose layer with its textures as a .usdz, so the stored mesh imports
from its bytes alone. Only files inside the mesh's folder are read (no absolute paths, URLs
or `..` above it); missing ones are named in the log.

- formats: `self_contained_mesh`, `read_mesh_file` and `MeshFile`; `import_mesh` uses them;
  the glTF reader no longer reads the disk itself; USD texture lookups go through one
  `Assets` source (usdz package or loose files)
- engine: file.open, file.new, file.reimportMesh, bake.highPoly.add and bake.cage.set read
  meshes this way; a failed reimport no longer leaves the session pointing at the new file
- automation: mesh_import / mesh.import read the files under the same workspace rules
- CLI `info` reports a .gltf with external buffers

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 13:16:59 +07:00
bflatasticandClaude Opus 5.5 2ddb156d69 Neutral names in code and packaging; README in the Crafting Apps layout
- Code comments, crate descriptions, the MCP stroke schema and the Linux package descriptions
  describe features in their own words instead of naming the reference application or other
  vendors' products (file format names stay)
- The README follows the layout the other Crafting Apps use (VectorCraft): a look around, made
  in TextureCraft, why TextureCraft, quick start with the agent setup, status, downloads per
  platform, the Crafting Apps, star history, license; no trademark footer
- The detailed feature list moves to docs/features.md
- A new path-traced render of the built-in crate textured with smart materials

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 12:55:42 +07:00
bflatasticandClaude Opus 5.5 55387bf0fd GPU baking, Alembic, templates, translations and 8K responsiveness
- Baking: per-map ray settings (AO, thickness, bent normals), GPU ray-traced baking with CPU
  fallback (~12x), color map from textured glTF high polys
- Files: Alembic (Ogawa) and FBX 6 import, per-tile UDIM resolution, converting a set to UV
  tiles, project templates, preserving painted strokes on mesh reimport
- UI: translations (French, German, Spanish, Portuguese, Italian, Japanese, Chinese, Korean)
  with a live language picker and CJK fonts, closed panels reopen where they were, viewport
  texture resolution setting, frame-budgeted scene sync for 8K sets
- Web: loading screen, WebGL2 notice, app-captured shortcuts, touch navigation

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 11:23:28 +07:00
bflatasticandClaude Opus 5.5 81d3f5c14c GPU path tracing, depth of field, cameras, glass, filters and decals
- Rendering mode traces on the GPU (compute shaders, ~25x the CPU tracer) with CPU fallback;
  CLI/MCP render --samples uses the GPU unless --cpu
- Depth of field in the viewport and the path tracer; multiple cameras with glTF import;
  transmission/IOR, coat normal and screen-space subsurface blur; exact 8-bit normal decode
- Filter library (18 filters incl. warp, color balance, gradient map, posterize, MatFinish)
  with a Filters shelf tab; geometry decals; clone from the current layer; anchors inside a
  content stack; instances across texture-set resolutions; drag saved smart materials

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 09:06:22 +07:00
bflatasticandClaude Opus 5.5 bdbb52c9b6 UDIM tiles, USD import/export, coat/sheen/anisotropy/subsurface shading
- UV tiles: auto-detected UDIM texture sets as one atlas per set, padding kept inside tiles,
  one file per tile with the $udim export token, builtin:udim_plane
- USD: usda/usdc/usdz import (Crate reader with LZ4) and export with UsdPreviewSurface
- Shader lobes: clear coat, sheen, anisotropy and subsurface scattering channels in the
  viewport and the path tracer; car paint, velvet, brushed steel, skin and wax materials;
  glTF clearcoat/sheen export
- Color swatch popups no longer stay open

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 19:45:14 +07:00
bflatasticandClaude Opus 5.5 2e74013c3e Painting performance, alpha library, export template editor
- Compositor caches the stack below and replays what lies above the layer being painted,
  also inside folders: painting under a smart material is ~10-25x faster per frame and the
  stroke commit 12-30x faster, bit-identical to a full composite
- Paint shows in the frame it is drawn; parallel stamp rasterizing and stroke commit;
  camera visibility reused between strokes
- 67 procedural brush alphas with an Alphas shelf tab; drag materials, smart masks and
  alphas from the shelf onto the layer stack, layers and viewport
- Export output template editor: user presets with per-channel packing, converted maps,
  import/export as JSON, validated at load
- Shift+right drag turns the environment; S+drag no longer orbits while moving the stencil
- Frame profiler and scripted paint test on the control channel (debug.frames, debug.paintTest)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 15:15:26 +07:00
bflatasticandClaude Opus 5.5 ec859420d5 TextureCraft: clean-room 3D texture painting in pure Rust
An open-source, clean-room implementation of a Substance 3D Painter-style texturing
workflow, written in pure Rust with egui and wgpu.

- Layer stack with 32 blend modes, masks, generators, content effects and anchor points
- Painting, projection, smudge, clone, path, lasso fill, particle brush and quick mask
- 43 procedural materials, 17 smart materials and 10 smart masks
- Mesh map baking with high-poly, cage and match-by-name support
- PBR viewport with HDR environments, TAA and a path-traced Rendering mode
- glTF, FBX, COLLADA, OBJ, PLY and STL import; texture export presets; OBJ and GLB export
- Dockable Painter-style UI, shortcut editor, web build, MCP server and CLI

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 01:33:13 +07:00