Robust Wavefront OBJ model parsing in C

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  1. assimp

    The official Open-Asset-Importer-Library Repository. Loads 40+ 3D-file-formats into one unified and clean data structure.

    Curiously, what people commonly refer to as 'Waterfront OBJ' is merely a tiny subset of that format dealing with polygons.

    The format supports e.g. higher order curves and surfaces and apps like Maya or Rhino3D can read and write OBj files containing such data. [1]

    Writing a parser for the polygon subset also comes with some caveats.

    If your target is a GPU you probably need to care for robust triangulation of n-gons and making per-face-per-vertex data per-vertex on disconnected triangles.

    Vice versa, if you are feeding data to an offline renderer you want to absolutely preserves such information.

    I believe the tobj Rust crate is one of the few OBJ importers that handles all edge cases. [2] If you think it doesn't, let me know and I will fix that.

    This is surprising for people familiar with one but not the other of the requirements of offline- or GPU rendering.

    I.e. if you write an OBJ reader this can become an issue, see e.g. an issue I opened here [3].

    1. https://paulbourke.net/dataformats/obj/

    2. https://docs.rs/tobj/latest/tobj/struct.LoadOptions.html

    3. https://github.com/assimp/assimp/issues/3677

  2. SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
  3. rapidobj

    A fast, header-only, C++17 library for parsing Wavefront .obj files.

  4. tinyobjloader

    Tiny but powerful single file wavefront obj loader

    Note that there's a great C99/C++ single header library, tinyobjloader, that provides robust (in my experience) and feature-full OBJ loading, including triangulation of n-gons and full material parsing.

    https://github.com/tinyobjloader/tinyobjloader

    It's fairly mature and handles many of the parsing footguns you'll inevitably run into trying to write your own OBJ parser.

  5. tinyobjloader-c

    Header only tiny wavefront .obj loader in pure C99

    Thanks!

    I had a look at the code and it looked distinctly like C++, but it turns out there is a C version [1] too. Haven't looked into it further.

    [1]: https://github.com/syoyo/tinyobjloader-c

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Open GL tutor request

    1 project | /r/opengl | 27 May 2023
  • From Blender to OpenGL

    1 project | /r/opengl | 12 Oct 2022
  • [Part 5] Update of my Vulkan toy renderer: Meshlet cone culling, fast_obj, Vulkan dynamic rendering and many more

    2 projects | /r/vulkan | 27 Aug 2022
  • Texture UV issue

    1 project | /r/opengl | 16 Dec 2021
  • ConjureEnum: lightweight header-only C++20 enum and typename reflection

    1 project | news.ycombinator.com | 4 Jun 2026

Did you know that C++ is
the 7th most popular programming language
based on number of references?