← Back to Pull requests

Add native mesh file I/O (OBJ, STL, PLY) #1369

Closed
unknown closed this pull request without merging on Sep 22, 2026 13:59 UTC
View on GitHub
unknown unknown commented on Apr 15, 2026 17:40 UTC
Author

Description

This PR adds native, zero-dependency mesh I/O utilities (wp.load_mesh() and wp.save_mesh()) to Warp as per the plan

Currently, loading basic test meshes in Warp requires either pxr.UsdGeom (a massive dependency) or third-party packages like trimesh. This forces many basic geometry tests and examples to be gated behind USD_AVAILABLE.

This PR implements lightweight, pure-Python parsers for standard mesh formats (Wavefront OBJ, ASCII/Binary STL, and ASCII/Binary PLY) directly into Warp. This is intended to drop the OpenUSD requirement for testing simple geometries and improve onboarding, not to replace high-performance C++ pipelines for massive assets.

Checklist

  • New and existing tests cover these changes.

  • The CHANGELOG.md entry has been added.
  • Test plan

  • Added a comprehensive suite of unit tests in (warp/tests/io/test_mesh.py) for OBJ, STL (ASCII/Binary + vertex deduplication), and PLY formats.

  • Generated standard geometric test assets (cube.obj, cube.stl, etc.).

  • Verified locally on CPU and CUDA (T4, sm_75) via: uv run --extra dev -m warp.tests -s autodetect -k TestMeshIO

  • 23+ mesh tests pass.
  • New feature / enhancement

    import warp as wp
    
    # One-liner to load a mesh (format inferred automatically, BVH constructed)
    mesh = wp.load_mesh("tests/io/assets/cube.obj")
    
    # Example loading binary STL with simple vertex deduplication
    mesh = wp.load_mesh("model.stl", stl_merge_tolerance=1e-5)
    
    # Save back out
    wp.save_mesh(mesh, "output.ply")
    

    Out of scope for this PR: Material/texture loading (.mtl files), animation/sequence loading, and GPU-accelerated parsing (file I/O is CPU-bound).

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    Summary by CodeRabbit

    New Features
    Native mesh import/export for OBJ, STL (binary/ASCII), and PLY (binary/ASCII) with zero external dependencies; auto-detection, optional winding flip, and device-aware load/save with round-trip support.

    Documentation
    Changelog updated and a detailed mesh I/O testing/status document added.

    Tests
    New unit and validation tests, deterministic mesh assets, and a validation script covering parsing, formats, edge cases, and round-trips.

    Examples
    Example updated to show alternative mesh-loading via the new I/O.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 316 lines (+237 / -79) across 3 files Reviewer: dhairyashilRG Review duration: 230178m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 316 lines diff across 3 files
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.345
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #1369"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 40.4% (MEDIUM) · Higher = larger blast radius
    40.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 16.0% · Safe to merge
    16.0%
    Repository