ds3 0.1.0

Pure-Rust parser for Autodesk 3D Studio (.3ds) binary files
Documentation
  • Coverage
  • 100%
    32 out of 32 items documented1 out of 7 items with examples
  • Size
  • Source code size: 64.68 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 605.62 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 6s Average build duration of successful builds.
  • all releases: 6s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • BlueJayLouche/3ds-rs
    1 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • BlueJayLouche

ds3

crates.io docs.rs

Pure-Rust parser for Autodesk 3D Studio binary (.3ds) files.

No dependencies on graphics engines — output is plain f32 arrays that you feed into Mesh::insert_attribute (Bevy), glBufferData (OpenGL), or whatever renderer you use.

The crate is published as ds3 (a Rust identifier can't start with a digit); the repository is 3ds-rs. It is no_std + alloc compatible (disable the default std feature) with a minimum supported Rust version of 1.70.

Installation

cargo add ds3
[dependencies]
ds3 = "0.1"
# no_std: ds3 = { version = "0.1", default-features = false }
# serde:  ds3 = { version = "0.1", features = ["serde"] }

Quick start

use ds3::parse;

let scene = parse(&std::fs::read("model.3ds")?)?;
for mesh in &scene.meshes {
    println!("{}: {} verts, {} faces", mesh.name, mesh.vertices.len(), mesh.faces.len());

    // Flat-shaded (one vertex per face corner)
    let (pos, nrm, uv, idx) = mesh.to_flat_buffers();

    // Smooth-shaded (vertices shared across smooth groups)
    let (pos, nrm, uv, idx) = mesh.to_smooth_buffers();
}

Features

Feature Description
serde Derives Serialize / Deserialize on all public types

Coordinate system

3DS stores vertices in right-handed Y-up. No axis permutation is required. The Mesh3ds::transform matrix is also Y-up.

Some exporters write Z-up regardless of the spec; swap Y/Z after parse if you know your source is Z-up.

Supported chunks

Chunk Parsed Notes
MAIN3DS (0x4D4D) Root container
EDIT3DS (0x3D3D) Editor container
NAMED_OBJECT (0x4000) Object name + children
N_TRI_OBJECT (0x4100) Triangle mesh container
POINT_ARRAY (0x4110) Vertex positions
FACE_ARRAY (0x4120) Face indices + flags
MSH_MAT_GROUP (0x4130) Material name (first only)
TEX_VERTS (0x4140) Texture coordinates
SMOOTH_GROUP (0x4150) Per-face smooth-group bitmask
MESH_MATRIX (0x4160) Local transform
MAT_ENTRY / MAT_NAME Material names collected in Scene3ds::materials

All other chunks are silently skipped.

License

Licensed under either of

at your option.