Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loaders #5524

Open
34 of 42 tasks
mrdoob opened this issue Oct 27, 2014 · 74 comments
Open
34 of 42 tasks

Loaders #5524

mrdoob opened this issue Oct 27, 2014 · 74 comments

Comments

@mrdoob
Copy link
Owner

mrdoob commented Oct 27, 2014

List of loaders that would be nice to have:

3D

Bitmap

  • DDSLoader
  • HDRLoader
  • TGALoader
  • TIFFLoader

Vector

@kaosat-dev
Copy link

Very extensive list !
I also propose AMF (http://en.wikipedia.org/wiki/Additive_Manufacturing_File_Format) loader.
(3d file format used for 3d printing).
I already have the basics of the loader done, so I could modify it a bit and add to the examples.

@Herst
Copy link
Contributor

Herst commented Oct 28, 2014

Most of these loaders are more important for special cases such as an editor, because for let's say games it might be better to convert into the three.js format straight away, right? In these cases the converters/exporters are more important.

@antont
Copy link
Contributor

antont commented Oct 28, 2014

We've tested glTF as a replacement for three's formats as an optimization - there the data is binary and can be compressed with geom compression.

Herst [email protected] kirjoitti Oct 28, 2014 kello 5:38 PM:

Most of these loaders are more important for special cases such as an editor, because for let's say games it might be better to convert into the three.js format straight away, right? In these cases the converters/exporters are more important.


Reply to this email directly or view it on GitHub.

@mrdoob
Copy link
Owner Author

mrdoob commented Oct 28, 2014

@kaosat-dev Added to the list!
@Herst Yes. It's mostly for editors or apps that don't require fast load times.

@jpsmith1981
Copy link

I am also looking for a IGES loader. I would even maybe start building one myself but not sure where to start.

@nyaaao
Copy link

nyaaao commented May 1, 2015

how about adding 3DM (used by Rhinoceros) to the list?

@mrdoob
Copy link
Owner Author

mrdoob commented May 1, 2015

@nyaaao added. thanks!

@DzzD
Copy link

DzzD commented May 1, 2015

About 3DS Loader :

Hi everyone, long time ago, I needed to make a 3DS loader for 3DzzD Web 3D engine, that was a little hard to do... not difficult to obtain some first results but rather to handle all the chunks correctly, but after some times I managed to produce a pretty efficient loader. the 3DS file format spécifications are difficult to find, but I finished to find one that worked pretty well. I 've built the loader for 3DzzD with this documentation and it works even better than the one in the current photoshop (better handle on pivot/smooth groups/scale/ keyframe/etc...), so here is the spécifications I have used (3DzzD source code is opensource and may help but code is really ugly... a ten years old project...)

http://dzzd.net/3DSChunkDefinitions.html

About OBJ Loader :

I modified the current OBJ loader and get about at least 10/15 FPS more on a lot of 3d models, but for now I did not found how I should do to post these changes ?

The problème was mainly due to the fact that the current OBJ loader create too many objects (more than the original 3d model, one object created at each material change) and also the 3dFaces with same material was not groupped together even within the same object, and was producing too many WebGL calls

@mrdoob
Copy link
Owner Author

mrdoob commented May 1, 2015

http://dzzd.net/3DSChunkDefinitions.html

Thanks! Added to the first post.

The problème was mainly due to the fact that the current OBJ loader create too many objects (more than the original 3d model, one object created at each material change) and also the 3dFaces with same material was not groupped together even within the same object, and was producing too many WebGL calls

Oh! Interesting. You mean the OBJMTLLoader one though. Right?

@DzzD
Copy link

DzzD commented May 2, 2015

Oh! Interesting. You mean the OBJMTLLoader one though. Right?

Yes,, to be more precise the "if ( /^usemtl /.test( line ) ) " block create a new object/mesh for each material switch, this ends with poor performance and a wrong objects hierarchy.

I will post a simple test case showing the difference between both the current loader and the one modified (difference is mainly noticeable on mobile device)

@DzzD
Copy link

DzzD commented May 2, 2015

Here is the test case for the current loader and the one optimised :

http://demo.dzzd.fr/threejs/OBJMTLLoaderTest/

EDIT:
I got 10 FPS on GalaxyTab3 with the current loader and more than 60 FPS with the new one, difference may be hard to see on fast devices

PS: If you wonder where the 3D model comme from :)

@jpsmith1981
Copy link

Does anyone know about IGES. I could really use an IGES loader. If someone could just point me in a direction to start on how to build one? Or if there is one out there somewhere. I noticed the folks at http://www.3dfile.io/ and some of the other 3D visualization sites are using ThreeJS and allowing for IGES uploads.

This was referenced Jun 30, 2015
@dubejf
Copy link
Contributor

dubejf commented Jul 1, 2015

K3D.js (MIT license) has a parser for OBJ, 3DS, MD2 and Collada. http://k3d.ivank.net. See #3843.

@jugl
Copy link

jugl commented May 11, 2016

how about NIfTI for doctor?

@mrdoob
Copy link
Owner Author

mrdoob commented May 11, 2016

@jugl Do you have any information about the format?

@team4music
Copy link

team4music commented May 16, 2016

I really hope for the .m2 models, its a huge community arround. I would offer my help with model files etc. you can contact me for that case on skype: deexone . As hint from one lib developer http://bridge.net/ could be maybe used to transform his lib to js.

@herzig
Copy link
Contributor

herzig commented Jun 20, 2016

Hey I have a BVH loader that parses through a BVH file and outputs a THREE.Skeleton and AnimationClip for easy use with the Mixer:
https://github.com/herzig/BVHImporter
and the working example: http://herzig.github.io/BVHImporter/
It's mainly tested on the CMU BVH files and some others.

Are there any guidelines on how the loader API should look like?

@mrdoob
Copy link
Owner Author

mrdoob commented Jun 20, 2016

@herzig Sweet! A BVHLoader would be awesome! Loaders basically have a .load() and .parse(). You can use MD2Loader as reference, but I would be happy to clean up your code if you do a PR with what you have now (an example + sample animation would be much appreciated too).

herzig pushed a commit to herzig/three.js that referenced this issue Jun 21, 2016
@rhairston rhairston mentioned this issue Jun 22, 2016
11 tasks
mrdoob pushed a commit that referenced this issue Jun 23, 2016
* Adds a BVH Loader & example #5524

* bVHLoader example fixed empty mesh errors.

* BVHLoader: replaced internal quaternions with THREE.Quaternion

* added BVHLoader example to example files

* removed arrow function notation

* BVHLoader example: replaced example animation.
@Itee
Copy link
Contributor

Itee commented Nov 10, 2016

Hi there,
just to sync this list with files loader in the repo...

3MFLoader is missing in the list but already implemented.
BinaryLoader is missing in the list but already implemented.
DDSLoader is missing in the list but already implemented.
FBXLoader is unchecked but already implemented.
HDRCubeTextureLoader is missing in the list but already implemented.
MD2Loader is unchecked but already implemented.
NRRDLoader is unchecked but already implemented.
PCDLLoader is missing in the list but already implemented.
PlayCanvasLoader is missing in the list but already implemented.
RGBLLoader is missing in the list but already implemented.
SVGLoader is unchecked but already implemented.
TGALoader is missing in the list but already implemented.
TTFLoader is missing in the list but already implemented.

next:

ASCLoader should be added to the list, and PR will be send in few days.
LASLoader should be added to the list, and PR will be send in few days.
XYZLoader should be added to the list, and PR will be send in few days.

Best regards,
Tristan

@mrdoob
Copy link
Owner Author

mrdoob commented Nov 13, 2016

just to sync this list with files loader in the repo...

Updated!

@dlabz
Copy link
Contributor

dlabz commented Nov 14, 2016

OpenCTM might be a good addition, since Autodesk is using it for their
cloud service
https://en.m.wikipedia.org/wiki/OpenCTM

On Sun, Nov 13, 2016 at 6:33 AM Mr.doob [email protected] wrote:

just to sync this list with files loader in the repo...

Updated!


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#5524 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAkmxkkOn179ZJvqc8yScOoxnaDGzuH6ks5q9qE6gaJpZM4CzpFw
.

@Itee
Copy link
Contributor

Itee commented Feb 20, 2020

I gave a try to an IFCLoader and how to say... This is quit impossible ! The whole code required to be able to parse correctly the IFC format is around 650 class files. (I know it because i did it). The loader will be 5 times bigger than the Threejs library.

About spec if you want implement your own: http://standards.buildingsmart.org/IFC/RELEASE/IFC4_1/FINAL/HTML/

I could release my code, and some help on it would be cool. But don't hope to see this loader in ThreeJs before a while...

@mrdoob
Copy link
Owner Author

mrdoob commented Feb 20, 2020

I could release my code, and some help on it would be cool. But don't hope to see this loader in ThreeJs before a while...

Why not?

@Mugen87
Copy link
Collaborator

Mugen87 commented Feb 20, 2020

BTW: I've lately spoken with a colleague and he told me that IFC is based on the STEP format which is well known in the CAD community. In general, STEP is really hard to parse and you would need to write a custom parser similar to VRMLLoader. However, IFC files can also be expressed in XML (they have the .ifcxml extension). Such files would be way easier to handle (see 3MFLoader or ColladaLoader) so the loader could focus on the actual geometry data building. Maybe it's easier to create a loader that only supports .ifcxml at the beginning?

@Itee
Copy link
Contributor

Itee commented Feb 24, 2020

@mrdoob, @Mugen87

Why not?

Because

The loader will be 5 times bigger than the Threejs library.

and i use Class with latest javascript features.

IFC is based on the STEP format which is well know in the CAD community.

Yes, one day i will show you what i'm doing with Threejs ;)

IFC files can also be expressed in XML (they have the .ifcxml extension).
...
Maybe it's easier to create a loader that only supports .ifcxml at the beginning?

The parsing is clearly not a big problem. But The geometries generation is ! Because ifc format does not contain any geometries. But use interpolation/interaction between objects to determine the final geometry.

Anyway, if you want it, maybe you should create a specific branch for this before taking any decision. Just to see the BIG thing.

@Mugen87
Copy link
Collaborator

Mugen87 commented Feb 24, 2020

The loader will be 5 times bigger than the Threejs library.

Well yes, if the loader is not so compact as the others, it's probably better to put the code into a separate repository.

@Jesusbill
Copy link

@Itee Any plan to release the IFCLOADER anytime soon?
Would be interested to see the BIG thing

@mrdoob
Copy link
Owner Author

mrdoob commented Apr 3, 2020

Not aware of anyone willing to contribute it and maintain it...

@antont
Copy link
Contributor

antont commented Apr 6, 2020

I'm using IfcOpenShell 's IFC converter happily, it makes nice geom and materials, can do Collada DAE (which we use to import to Unity), IIRC OBJ and was there glTF nowadays too

@MaartenBreeedveld
Copy link

I'm using IfcOpenShell 's IFC converter happily, it makes nice geom and materials, can do Collada DAE (which we use to import to Unity), IIRC OBJ and was there glTF nowadays too

But do you use any of the IFC data like Buildingstorey, Site, etc?
There's no doubt the web would be better off being able to parse IFC and not this shitty client-server thing everyone's dealing with.

I've given this a shot recently. I've managed to generate some geometry
image

But it should actually be this:
image

The basic thing that went wrong is the actual placement and rotation here and my 3D maths are next to non-existent (I simply don't have the patience).

Though there are many classes in the IFC schema. The eventual filesize could be reduced by using Typescript interfaces and using functions to look up and apply the arguments of each 'STEP' in the file.

Bottomline, for an IFC Loader; I don't know if we've got ourselves a 3D Maths genius, because that would solve a lot of problems parsing the mathematical relations while constructing the geometry.

@antont
Copy link
Contributor

antont commented May 19, 2020

But do you use any of the IFC data like Buildingstorey, Site, etc?

Yes, via Tridify's conversion service, which uses IfcOpenShell as well (I've also used it locally) for the geom. I figure those metadatas are what is easy to parse.

The geometry generation is indeed nontrivial. If you wanna do it in the browser, maybe you can compile IfcOpenShell to WebAssembly and use it as a library from your Javascript. It's plain C++ with no GUI or anything, just a library for which there is a commandline interface separately, so it might be easy to build for the web too. Parsing IFCs is kinda heavy so getting the WASM performance and low memory footprint might be nice. And the lib does a beautiful job at creating the geom.

@Jesusbill
Copy link

@MaartenBreeedveld I can help with the maths, for the theoretical basis I have non doubt and I have some experience with ifc, in fact there could be several transformations in series required for the world coordinates. For the implementation in three.js perhaps it will be possible to optimize it.

@MaartenBreeedveld
Copy link

But do you use any of the IFC data like Buildingstorey, Site, etc?

Yes, via Tridify's conversion service, which uses IfcOpenShell as well (I've also used it locally) for the geom. I figure those metadatas are what is easy to parse.

The geometry generation is indeed nontrivial. If you wanna do it in the browser, maybe you can compile IfcOpenShell to WebAssembly and use it as a library from your Javascript. It's plain C++ with no GUI or anything, just a library for which there is a commandline interface separately, so it might be easy to build for the web too. Parsing IFCs is kinda heavy so getting the WASM performance and low memory footprint might be nice. And the lib does a beautiful job at creating the geom.

We've tried this in the past. But the WASM compiled version is a 40MB download I guess this is due to all the referenced libraries in ifcConvert.

@Jesusbill, Awesome! Currently, I've got no time to work on this project. But if it's okay, I'll come back to you.

@Jesusbill
Copy link

Awesome! Currently, I've got no time to work on this project. But if it's okay, I'll come back to you.

Sounds good @MaartenBreeedveld

@mrdoob
Copy link
Owner Author

mrdoob commented Jun 3, 2020

Added VDBLoader to the list. https://www.openvdb.org/

@kushal-borana
Copy link

Any idea about IFCLOADER? @mrdoob

@mrdoob
Copy link
Owner Author

mrdoob commented Aug 1, 2020

Nope

@fraguada
Copy link
Contributor

fraguada commented Aug 5, 2020

Regarding a 3dm loader: I've started work on this now that the openNURBS library has been compiled to wasm thanks to emscripten (rhino3dm).

I'm working on this here and have mesh, breps, extrusions, pointclouds, materials, layers, and groups support started and working.

image

Relevant files:

I hope to submit a PR that has support for more object types sometime soon. I must admit that I've little experience with web workers, and am leaning on the draco and basis loader examples. Hopefully #18234 simplifies this a bit.

p.s. we are already adding threejs support directly to the rhino3dm.js library like here and here.

Edit: update links to point to McNeel org fork.

@fraguada
Copy link
Contributor

We can check this one off ;)
image

@mrdoob
Copy link
Owner Author

mrdoob commented Mar 30, 2021

IFCLoader just landed! 🍾 #20598

@Faq
Copy link

Faq commented Aug 15, 2021

Any update about M2Loader? Anyone working with that?

@mrdoob
Copy link
Owner Author

mrdoob commented Aug 15, 2021

@Faq Not that I know of...

@Mugen87
Copy link
Collaborator

Mugen87 commented Aug 12, 2022

FYI: TIFFLoader has been added via #24420 🎉 .

@Mugen87
Copy link
Collaborator

Mugen87 commented Aug 20, 2022

Any update about M2Loader? Anyone working with that?

I've recently implemented a basic loader for M2 assets for a small personal project. If you want to play around with the code, you can access it via: https://gist.github.com/Mugen87/c96757cec0f7ec02214d6fdea880dec9

Use M2Loader like so:

const loader = new M2Loader();
loader.load( 'models/m2/cat/druidcat2.m2', function ( mesh ) {

    scene.add( mesh );

} );

And you get:
image

We can potentially add the loader's code to the repo. However, adding an example is problematic since all M2 assets I have found so far are directly from WoW and not available under an appropriate license.

Independently, I would love to add more features to the loader over time. Especially animations and multi-textured assets as well as supporting more asset versions.

@Mugen87
Copy link
Collaborator

Mugen87 commented Aug 20, 2022

I've played World of Warcraft in the past (nightelf druid, feral build) and loved the entire art design so much. Now seeing game assets rendered so nicely with three.js makes me a bit emotional 😊.

@Mugen87
Copy link
Collaborator

Mugen87 commented Aug 23, 2022

Multi-textured assets work now (example 7ne_druid_worktable02.m2):

desk

Now comes the most complex part: Skeletal animation.

@Mugen87
Copy link
Collaborator

Mugen87 commented Sep 1, 2022

I've created a new repository three-m2loader for maintaining/developing M2Loader.

https://github.com/Mugen87/three-m2loader

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests