Skip to content

Paint v2: Slice G — Cavity / curvature / AO masks #550

@fernandotonon

Description

@fernandotonon

Parent epic: #543
Depends on: Slice C (#546)

Goal

Auto-generate per-mesh cavity, curvature, and AO maps; use them as brush colour sources or layer masks — the canonical way to add edge wear, crevice dirt, and weathering.

Scope

  • Generators:
    • Cavity — concave dark; per-vertex from normal angle to neighbours (via HalfEdgeMesh), then rasterised to UV space with seam dilation (reuse VertexColorBaker seam plumbing).
    • Curvature — signed cavity (concave -, convex +). Edge wear from positive curvature.
    • AO — short-ray hemispherical occlusion. CPU bake, few seconds on 5k-tri meshes.
  • Cache in <AppData>/paint/derived_maps/<mesh-hash>/. Invalidate on topology change via EditableMesh revision counter.
  • Usage:
    • Brush colour source: brush colour × derived map value at painted UV; combines with gradient/stamp colour.
    • Layer mask: a layer's mask initialised from a derived map; user paints on top to refine.
  • One-click recipes:
    • "Add edge wear" — inverse-curvature-masked layer, default = light bare metal.
    • "Add crevice dirt" — cavity-masked layer, default = dark grime.
    • "Add AO darken" — multiply layer of AO onto BaseColor.
  • "Recalculate derived maps" button (manual invalidate).

Acceptance Criteria

  • Cavity, curvature, AO compute correctly on a fixture with clear convex/concave regions.
  • Maps cache + reload without recomputing.
  • Each map can drive brush colour or initialise a layer mask.
  • Each one-click recipe produces visibly correct results.
  • Maps recompute on topology change.
  • Sentry breadcrumb paint.derived_map.*.

Effort

~7 days.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpaintPaint tools (vertex, texture, projection, layers, brushes)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions