mrdoob / three.js

JavaScript 3D Library.
https://threejs.org/
MIT License
100.47k stars 35.21k 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

kaosat-dev commented 9 years ago

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

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

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 notifications@github.com 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 commented 9 years ago

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

jpsmith1981 commented 9 years ago

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

nyaaao commented 9 years ago

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

mrdoob commented 9 years ago

@nyaaao added. thanks!

DzzD commented 9 years ago

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

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

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

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

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.

dubejf commented 9 years ago

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

jugl commented 8 years ago

how about NIfTI for doctor?

mrdoob commented 8 years ago

@jugl Do you have any information about the format?

team4music commented 8 years ago

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

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

@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).

Itee commented 7 years ago

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

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

Updated!

dlabz commented 7 years ago

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 notifications@github.com 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 https://github.com/mrdoob/three.js/issues/5524#issuecomment-260168120, or mute the thread https://github.com/notifications/unsubscribe-auth/AAkmxkkOn179ZJvqc8yScOoxnaDGzuH6ks5q9qE6gaJpZM4CzpFw .

mrdoob commented 7 years ago

@dlabz We do have a CTMLoader already.

jjPlusPlus commented 6 years ago

I'm working with some iOS devs in the AR space, might there be a loader for the binary SCN files used by Apple in ARKit? I'm working on making use of the BinaryLoader and we'll see if I can get that working.

mrdoob commented 6 years ago

Is there a spec somewhere for that SCN format?

jugl commented 6 years ago

@mrdoob Sorry I'm so late. NIfTI is a NMR data format which transferred from DICOM. My current solution is get a 3D shape from it as VTK/OBJ format.

mrdoob commented 6 years ago

I see. Is there a spec somewhere?

YouYue123 commented 6 years ago

How about IFC loader. This format is using very common in construction for its 3d model

mrdoob commented 6 years ago

@YouYue123 https://github.com/mrdoob/three.js/issues/9764

YouYue123 commented 6 years ago

@mrdoob Thank you very much.

Aarbel commented 6 years ago

@mrdoob what are the guidelines + knowledge prerequisites to build a three.js loader ? I want to build one, but it want to be sure to make it the right way. Thanks

looeee commented 6 years ago

@Aarbel what format do you want to build a loader for?

Aarbel commented 6 years ago

@looeee .ifc files

Mugen87 commented 6 years ago

The basic structure of your loader would look like this:

import {
    FileLoader,
    Loader,
    LoaderUtils
} from '../../../build/three.module.js';

function IFCLoader( manager ) {

    Loader.call( this, manager );

}

IFCLoader.prototype = Object.assign( Object.create( Loader.prototype ), {

    constructor: IFCLoader,

    load: function ( url, onLoad, onProgress, onError ) {

        var scope = this;

        var path = ( this.path !== undefined ) ? this.path : LoaderUtils.extractUrlBase( url );

        var loader = new FileLoader( scope.manager );

        loader.load( url, function ( text ) {

            try {

                scope.parse( text, path, onLoad, onError );

            } catch ( e ) {

                if ( onError !== undefined ) {

                    onError( e );

                } else {

                    throw e;

                }

            }

        }, onProgress, onError );

    },

    parse: function ( text, path, onLoad, onError ) {

        // parsing logic goes here

    }

} );
Aarbel commented 6 years ago

thanks, will work on it next month

Mugen87 commented 6 years ago

Good luck! 😊

takahirox commented 6 years ago

Should default crossOrigin be Anonymous?

Mugen87 commented 6 years ago

I've reused the pattern from GLTFLoader and ColladaLoader.

onthez commented 6 years ago

I would like to see a LWO loader. File spec is well documented here: http://static.lightwave3d.com/sdk/2018/html/filefmts/lwo3.html

I often see LWO file size around 1/10 that of OBJ, and the format can contain morph data and a number of other features OBJ won't allow for. Also many of the models NASA makes available are only in LWO format https://nasa3d.arc.nasa.gov/search/lwo/model

If I knew what I was doing, I would attempt to get this rolling, but writing a loader is beyond anything I've done before.

donmccurdy commented 6 years ago

FWIW there is an LWO parser here: https://github.com/marcbizal/lwo-parser ... hypothetically that would be a good start for a loader or a converter, but unfortunately it doesn't seem to support the particular version of the LWO format that NASA is using. It expects LWOB (binary?) but the magic version string on the NASA model I tried was LWO2. If you do find a working parser written in some language other than JS, it may be easier to write a converter to something three.js supports, rather than trying to write a new parser in JS.

Aarbel commented 6 years ago

Hi, my schedule changed a lot so no time to work on .ifc loader for three.js. Could be great to fetch the contact of this guy : https://github.com/mrdoob/three.js/issues/9764

adrs2002 commented 5 years ago

I'm sorry I didn't realize

I was making a loader of "LWO 2". However, I thought that there was no demand and I did not complete it.

http://adrs2002.com/sandbox/lwoLoader/lwoTest.html https://github.com/adrs2002/threeLwoLoader

I hope it will be helpful for something.

LordMagnum commented 5 years ago

Hello everybody,

I saw that M2 is in the list.

This is interesting for me because I would like to realize a character, object, NPC and item viewer with Three.

In connection with M2 is synonymous BLP2 (Blizzard Picture File) that similar to DDS S3 Texture Compression used.

I have found so far:

.m2 = https://github.com/vjeux/jsWoWModelViewer

.blp

I myself try to add it, but I'm still a little too inexperienced with the whole :D

mrdoob commented 5 years ago

@adrs2002 A LWOLoader would be great! Would you like to do a PR with what you have?

mrdoob commented 5 years ago

I myself try to add it, but I'm still a little too inexperienced with the whole :D

Take your time 👌

looeee commented 5 years ago

A LWOLoader would be great!

I wrote an LWO3 loader a couple of months ago, working for onthez.com. We agreed on a period of exclusivity then we'll contribute it here. Hopefully sometime around the end of February.

I think @jds580s is Justin from on the z, perhaps he can give a better idea of when we can add it here.

adrs2002 commented 5 years ago

@mrdoob @looeee I think that commit of LWO2 loader is unnecessary if looeee's LWO3 loader will committed. LWO3 format is because it contains all succeeds of LWO2 format.

looeee commented 5 years ago

LWOLoader has landed! 😁

16011

rubenflush commented 4 years ago

Any update on the IFC loader? Would be nice for construction views!

Itee commented 4 years ago

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

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?