mrdoob / three.js

JavaScript 3D Library.
https://threejs.org/
MIT License
100.75k stars 35.22k forks source link

Loaders #5524

Open mrdoob opened 9 years ago

mrdoob commented 9 years ago

List of loaders that would be nice to have:

3D

Mugen87 commented 4 years ago

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 commented 4 years ago

@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 commented 4 years ago

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 commented 4 years ago

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

mrdoob commented 4 years ago

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

antont commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

@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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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

kushal-borana commented 3 years ago

Any idea about IFCLOADER? @mrdoob

mrdoob commented 3 years ago

Nope

fraguada commented 3 years ago

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 commented 3 years ago

We can check this one off ;)

image
mrdoob commented 3 years ago

IFCLoader just landed! šŸ¾ #20598

Faq commented 2 years ago

Any update about M2Loader? Anyone working with that?

mrdoob commented 2 years ago

@Faq Not that I know of...

Mugen87 commented 1 year ago

FYI: TIFFLoader has been added via #24420 šŸŽ‰ .

Mugen87 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

desk

Now comes the most complex part: Skeletal animation.

Mugen87 commented 1 year ago

I've created a new repository three-m2loader for maintaining/developing M2Loader. When the loader is more mature and we have some CC licensed assets, we can consider to add an external example to the three.js repo.

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