Skip to content

fix(3d): auto-unwrap overlapping or stretched untextured mesh UVs - #504

Open
Addressmehari wants to merge 3 commits into
bearcraft-studios:mainfrom
Addressmehari:fix/android-modify-canvas-touch
Open

Addressmehari wants to merge 3 commits into
bearcraft-studios:mainfrom
Addressmehari:fix/android-modify-canvas-touch

Conversation

@Addressmehari

@Addressmehari Addressmehari commented Dec 4, 2026 •

Copy link
Copy Markdown

Summary

This PR fixes two Android 3D painting usability issues and adds a top-right 3D orbit gizmo:

  1. Fix □ (Modify) + finger drag on Android (ce8c6ada)

    • Problem: Pressing □ in Chrome.kt consumed ACTION_DOWN inside Compose, so AndroidView(CanvasSurfaceView) never received the second finger's touch events—preventing □ + finger drag (e.g., 3D model orbiting when 3D painting with a finger is enabled).
    • Fix: Track modifyPointerId in CanvasViewModel and forward non-□ pointers from AppRoot.kt's root PointerEventPass.Initial to vm.canvasTouch.
  2. Add Blender-style 3D Orbit Gizmo on Android (1e544b74)

    • Exposed model_rotation() and snap_model_view(yaw, pitch) on CanvasSession (scene3d.rs).
    • Added OrbitGizmo in the top-right corner (OrbitGizmo.kt, AppRoot.kt) supporting free 3D orbit dragging, tap-to-snap on ±X / ±Y / ±Z axes, X / Y axis-lock toggles, and 15° snappy step mode.
  3. Auto-unwrap overlapping, stretched, or out-of-bounds UVs on untextured meshes (8240a068)

    • Problem: Models without existing image maps that had overlapping, degenerate, out-of-bounds, or heavily stretched UVs caused strokes to streak or mirror across unrelated parts of the mesh.
    • Fix: Added part_has_maps(), part_needs_atlas_uvs(), and ensure_non_overlapping_uvs() in crates/engine/src/mesh.rs (called from open_model and open_saved_model in scene3d.rs) to group connected faces into tangent-projected UV charts and shelf-pack them cleanly into [0, 1].

Testing

  • Tested 3D model import, UV unwrapping, and stroke projection on Windows (procraft-desktop).
  • Tested Android build (installDebug) and 3D orbit/painting controls on device.

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.

1 participant