OBJ Rewrite
See original GitHub issueI’ve stalled a little bit on the OBJ rewrite due to other projects. It’s decently close however, and if anyone is interested in working on it, it would be appreciated!
The feature/obj
branch includes a mostly fresh pass at an OBJ loader. In my testing on large files, it was roughly 3x faster than the previous loader. Most of the gains are from doing string preprocessing operations, and processing only relevant substrings as much as possible, through str.find
and str.rfind
, and then loading data with np.fromstring
. For small meshes, it has basically the same performance as the old loader.
It also handles multiple textures by splitting at every usemtl
or o
tag, which become a new mesh, which the current loader doesn’t handle well (or at all).
Developing
If you run ipython -i obj.py
in the root directory, it will load, profile, and compare performance to the old loader, which hasn’t been touched. When this is further along we’ll jettison the old loader and replace it with obj.py
. I recommend doing it on a large- ish mesh (as small meshes load so quickly they are dominated by things like PIL image loading).
Scope
- Load vertices (
v
) - Vertex colors (on the same line as
v
) - Vertex normals (
vn
) - Vertex texture coordinates (
vt
) - Triangular and quad faces
- Find an OBJ with mixed tri/quad to test against
- Multiple materials
- Multiple objects (
o
) - Materials with color information but no image render in
viewer.windowed
(maybe these should be converted toface_colors
? - Keep track of face groups
g
- Keep track of smoothing groups
s
- Useable kwargs
- Usable kwargs with texture
Issue Analytics
- State:
- Created 4 years ago
- Comments:14 (10 by maintainers)
Top GitHub Comments
Sounds good! Talk to you tomorrow @ 2
Moving conversation to the PR: #436