Skip to content

Load OBJ material sidecars in importer - #12843

Draft
Reza2kn wants to merge 1 commit into
rerun-io:mainfrom
Reza2kn:codex/obj-mtl-import
Draft

Load OBJ material sidecars in importer#12843
Reza2kn wants to merge 1 commit into
rerun-io:mainfrom
Reza2kn:codex/obj-mtl-import

Conversation

@Reza2kn

@Reza2kn Reza2kn commented Jul 10, 2026

Copy link
Copy Markdown

Related

What

This PR makes native OBJ file imports resolve their Wavefront material sidecars instead of logging the OBJ bytes as a standalone Asset3D blob.

When an .obj file is opened through the importer, Rerun now:

  • loads referenced .mtl files relative to the OBJ file,
  • converts each OBJ model into native Mesh3D data,
  • preserves positions, triangle indices, normals, and UV coordinates,
  • maps MTL Kd/d values to Mesh3D::albedo_factor,
  • decodes map_Kd diffuse textures and logs them as Mesh3D albedo textures.

This leaves non-OBJ mesh imports on the existing Asset3D path.

Screenshot

Imported OBJ with its referenced MTL and PNG texture preserved:

Imported textured OBJ in Rerun

Notes

#3772 fixed .obj media-type guessing. The remaining issue in #3773 was that an OBJ file loaded by itself has no access to its MTL/texture sidecars at render time. Resolving those sidecars in the native file importer lets the viewer receive complete Mesh3D archetypes with material data already attached.

Validation

  • cargo fmt -p re_importer
  • git diff --check
  • cargo check -p re_importer
  • cargo test -p re_importer --test test_obj_importer
  • cargo test -p re_importer
  • cargo clippy -p re_importer --all-targets -- -D warnings
  • cargo check -p re_view_spatial
  • RUST_LOG=error cargo run --package rerun-cli --no-default-features --features release_no_web_viewer -- /Users/Ajab/Downloads/Meshy_AI_Color_Ripple_0710165213_texture_obj/Meshy_AI_Color_Ripple_0710165213_texture.obj --headless --screenshot-to .context/obj-mtl-screenshot/color_ripple_obj_import_wide.png --window-size 1900x1100 --renderer=metal

@Reza2kn
Reza2kn force-pushed the codex/obj-mtl-import branch from f917f31 to 9576d31 Compare July 10, 2026 17:08
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.

Loading obj files doesn't load associated mtl files

1 participant