Twinklebear / tobj

Tiny OBJ Loader in Rust
MIT License
233 stars 47 forks source link

Support Pixar tag (`t`) extension #57

Open virtualritz opened 1 year ago

virtualritz commented 1 year ago

Pixar has an undocumented extension for OBJ files where tags can be stored in the OBJ. Commonly those are attached to vertices (or edges/edge chains, by specifying them through the contained vertices). Each tag can contain integer and/or float and/or string tokens.

An example is found in the tinyobjloader repo. where this is used to store crease values on edges for rendering the geometry as a subdivison surface.

The code for parsing the crease tags is found here.

One of the issues is that Pixar decided to just export these tags from the Ri inteface representation which uses zero-based indexing. I.e. if this was to be adopted on a wider scale for import/export of OBJs it would probably make sense to use 1-based indexing for any references e.g. stored in a tag's integer tokens (referencing geometry inside the OBJ).