Idea: Use *.3js as the extension for ThreeJS JSON files, increases flexibility.
So I have a bunch of files on my desktop. Some are STL, others are DAE (Collada) and some are JSON. Some JSON files are ThreeJS scenes but others aren't. It is really hard to tell which are actually ThreeJS scene files without opening them.
Why doesn't ThreeJs start using a custom extension to differentiate its files from just plain old JSON? It can still be JSON internally. I was thinking of something like *.3js.
This way we could optionally add compression to 3JS Scene Files, such as ZIP and then the files will be a lot smaller as well. But this would be part of the 3JS file specification.
Anyhow, just a thought.
This would also allow Github to automatically display 3JS files using a ThreeJS-based viewer. Right now as they use a JSON extension, Github will have to actually look at the file contents before running a viewer as most JSON files are not ThreeJS scenes.
Yep. In fact, maybe something like .3geo .3scn (or .3obj) .3mat. Or maybe just .3js and let the metadata tell the parser what it is...
Kind of related, lately I'm working on SceneExporter2. And more and more I feel like I should rename it to Object3DExporter, after all what you want is the hierarchy and not so much the scene. Maybe HierarchyExporter or GraphExporter...
I'd suggest a single file format to keep things easy. The division of OBJ/MTL is always annoying, I much prefer single files like FBX and DAE where everything is together.
I think a 3JS (or .threejs, which is also nice just on the long side) file should contain a hierarchy of nodes, it doesn't have to be the full scene, and it can easily be a single node.
Why not just call it the ThreeJSExporter/ThreeJSImporter -- the name of the file format.
Collada is the same way, it can be part of a scene or everything. No need to call it a ColladaHierarchyExporter/Importer. ;-)
A .3js/.threejs can also just be a bunch of materials or a single material. Thus one format to rule them all is my suggestion. So much easier to manage from a programming standpoint.
Well, the thing is that we can export 3 things: Geometries, Materials and Scenes/Hierarchies. SceneExporter2 uses GeometryExporter and MaterialExporter to embed the appropriate json object. Ideally SceneExporter will also support external files.
All these formats/loaders/exporters are WIP from the last 2 cycles.
I could be wrong about all this as I am not writing games with Three.js.
I'd still suggest a single format. The structure can be scene hierarchy + mesh list + material list. The scene hierarchy can reference the meshes and the materials. Each of these three elements would be optional. One can add further elements in the future.
I would suggest not building in referencing to other files as I think it will complicate things and I am not sure of the value. People can still load one .3js/.threejs file per asset this way and it keeps it really simple.
Having a single file format will make things a lot easier. I think having it in one file will make it a lot easier to view and organize assets, such as a Github-based ThreeJS viewer.
This is similar to the old .x DirectX file format. Basically it is one file format but you can store a lot of different data in it including materials, hierarchy and animations.
http://msdn.microsoft.com/en-us/library/windows/desktop/bb174837(v=vs.85).aspx
Should one embed the textures into the .3js/.threejs files? I think that is the harder question to answer. FBX does embed and so does *.x.
Well, the current scene format already supports external links and I'm planning to keep support:
http://threejs.org/examples/webgl_loader_scene.html http://threejs.org/examples/scenes/test_scene.js
As @arodic was suggesting on another channel it would be pretty handy if a scene could have another external scene as part of its hierarchy. Sort of instancing a external geometry (or graph) in your scene. The good news is that this isn't hard to implement. As long as it's well designed from the ground up.
I'm still figuring this out, but as soon as I figure out I'll write a format spec like the one we have for geometry.
have you seen this? https://github.com/KhronosGroup/glTF
Maybe use this in the near future to be compatible with everyone else ?
See press release? http://architosh.com/2013/04/webgl-gets-update-and-collada-becomes-iso-standard/
That format is very WebGL oriented. The one I'm doing is more neutral.
You may also like to give a try to the X3D format: it's already made to have materials, geometries (and interactions) in a single file and can reference external scenes as well, plus it's also an ISO standard.
XML is not nice to parse with JavaScript. Loading a loader for it would be nice though.
Just a thought, what about "whatever.three.js"? Multiple level extensions allow multiple file formats to coexist, something like "whatever.three.xml" or "whatever.three.tar". This kind of structure is heavily used on some MVC web frameworks to allow "views" to be implemented in a variety of media, like HTML, JSON (ajax) and XML.
I like that idea @samuelgrigolato.
I would ask that the file extension be unique. Having *.js at the end will cause a lot of trouble. The Github STL viewer was made possible in part because the extension *.stl is fairly unique.
.3js is my favourite so far. Or .3json. Hehe.
just my 2 cents: There are so many exchange file formats for 3D out there and you want to create another one? One already has to google for 1h to know what format supports what kind of data and other stuff. Although it would be easier to program i guess, i am not sure if this is the way you guys should go.
@GuyGood You're 2 years late.
? what, why is that? Please, explain :)
@GuyGood This thread wasn't started to explain you why we created our own format 2 years ago. This thread was created to discuss the idea or using .3js as extension instead of .js for our own file format.
Please, be a good open source citizen and don't derail topics for your own good.
MrDoob: Sorry, that was not my intention, I am sorry.
Btw. it wasn't for my own good^^ I can live with every format you are going to choose and every file format extension. I was just thinking a bit forward but you are right that this would be another topic. Just maybe keep in mind that every day people come asking in the chat about how to import export and that this and that model/format does not work. And you are creating "another" file format here.
.3js is nice though and the idea behind it is cool too in general ;)