Difference between ObjLoader and ObjLoader2 in Three.js
Asked Answered
F

3

11

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.

Fiertz answered 22/12, 2017 at 15:43 Comment(0)
N
11

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

Netherlands answered 25/12, 2017 at 3:15 Comment(1)
I'm still wondering in which case we should use one or another. Is OBJLoader2 experimental and we should use the original if we want a stable version? For example, and I'm just guessing, OBJLoader2 could be faster but OBJLoader could be able to load more models and in that case, I would use one or another depending on what I want to achieve in my website.Fiertz
W
9

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      ║
╚════════════════════════════════════╩═══════════╩════════════╝
Wiltonwiltsey answered 25/11, 2018 at 6:10 Comment(0)
A
5

For now, The main difference is that the OBJLoader2 supports web worker for asynchronous loading. And it offer a choice for user between syn and asyn.

Antigen answered 2/6, 2018 at 7:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.