Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between ObjLoader and ObjLoader2 in Three.js

Tags:

three.js

3d

.obj

What's the main difference between this two classes, ObjLoader and ObjLoader2?

In which case we should use one or another?

Why there are two classes? Is one more stable or efficient than the other?

It's not very clear for me when I read the documentation.

like image 924
fsinisi90 Avatar asked Dec 22 '17 15:12

fsinisi90


2 Answers

I have sometimes wondered this too..
So I decided this time to jump down the rabbit hole (writing this post as I go down the hole).

This is what I have found.

  • The first commit of OBJLoader2 had the comment "Added Geometry2 based OBJLoader." by mrdoob as seen here.
  • Geometry2 seems to have been part of some experiments to combine the ease of use of Geometry with the performance of BufferGeometry. An issue mentioning Geometry2 can be viewed here.
  • There are recent commits for both OBJLoader and OBJLoader2.
  • All the recent commits seem to be from a single person (kaisalmen)

So, It seems to me that OBJLoader2 is meant to be a more performant loader for OBJ files. Having a look at The main commiter's github page reveals a repository specifically for the OBJLoader2 class.
There is documentation on the OBJLoader2 class in the authors github repository here

like image 143
2pha Avatar answered Sep 29 '22 21:09

2pha


Found some interesting comparisons by the creator here:

╔════════════════════════════════════╦═══════════╦════════════╗
║ Feature                            ║ OBJLoader ║ OBJLoader2 ║
╠════════════════════════════════════╬═══════════╬════════════╣
║Handle all face types               ║     x     ║     x      ║
║Support for points and lines        ║     x     ║     x      ║
║Negative face indices               ║     x     ║     x      ║
║Support Ngons                       ║     x     ║     x      ║
║Flat/Smooth Multi-Materials         ║           ║     x      ║
║Indexed Rendering                   ║           ║     x      ║
║Handle Face-Type change inside group║           ║     x      ║
║Deactivate console logging          ║           ║     x      ║
║Load MTLs via MTLLoader if desired  ║           ║     x      ║
╚════════════════════════════════════╩═══════════╩════════════╝
like image 30
phreakhead Avatar answered Sep 29 '22 19:09

phreakhead