mrdoob / three.js

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

FBX Binary format not supported? #9860

Closed RicoLiu closed 7 years ago

RicoLiu commented 8 years ago
Description of the problem

qq 20161014151051

FBXLoader only supports FBX text format?

Three.js version
Mugen87 commented 8 years ago

Yes. Right now FBXLoader only supports ASCII format in version 7.

RicoLiu commented 8 years ago

Three.js version : r77

qq 20161014175807

Why?

Mugen87 commented 8 years ago

/ping @yamahigashi

makc commented 8 years ago

Why?

because there is no reference open-source implementation? if you know one, I would be curious to see it.

makc commented 8 years ago

Ah, wait, I thought it was about binary. For ASCII FBX below v7, I had the code here and a bunch of test models somewhere in my hard drive.

takahirox commented 8 years ago

Anyone here who has made or is making binary FBX parser? If not, I'm feeling like trying to make that...

makc commented 8 years ago

you have to love reverse engineering stuff to do this ) and, you may be lucky if it is simple tags, but if they serialize every data type uniquely, you are properf-ed: you're facing tweaking one number per model and saving it to see what has changed, at a time.

takahirox commented 8 years ago

Thanks for the advice. I've achieved to make a FBX binary parser by seeing this site now.

https://code.blender.org/2013/08/fbx-binary-file-format-specification/

I'll try to make ObjectParser which makes an object from the result of the binary parser next.

makc commented 8 years ago

oh wow, someone already went through the hell ,and there are specs )

yamahigashi commented 8 years ago

https://banexdevblog.wordpress.com/2014/06/23/a-quick-tutorial-about-the-fbx-ascii-format/ I think this link also is great stuff for to do that.

Mugen87 commented 8 years ago

@takahirox It would be great if the new parser would have a similar structure like THREE.PLYLoader. This implementation uses an uniform logic for creating the THREE.BufferGeometry object after parsing the data from an ASCII or Binary input (see usage of method handleElement).

takahirox commented 8 years ago

ok I'll try. And I'm thinking if I also can use that for MMDLoader.

BTW does anyone here know if FBX binary format remains the same even below version 7?

RicoLiu commented 8 years ago

I have no idea.

Maybe @mrdoob knows?

makc commented 7 years ago

@takahirox did you share your binary fbx parser anywhere?

takahirox commented 7 years ago

Not yet... I'll do soon!

jmsaulnier commented 7 years ago

@takahirox Any updates :) ? Thanks!

takahirox commented 7 years ago

Sorry I've been busy lately... but soon soon!

jmsaulnier commented 7 years ago

@takahirox Awesome \o/

takahirox commented 7 years ago

I'm gonna start to work on FBX binary parser again from April. LMK if anyone is in hurry.

avaer commented 7 years ago

@takahirox Do you have something rough to share? We're doing a presentation at the end of the week and could really use FBX binary loading for the demo.

adam-clarey commented 7 years ago

Hi @takahirox I'm actually in a hurry, is there any update on this? I can help where able, but this is all still new to me.

takahirox commented 7 years ago

I'm just starting to work on that again. At least, I still need some weeks to share that.

adam-clarey commented 7 years ago

How many weeks do you think?

takahirox commented 7 years ago

Hm, maybe two or three weeks?

adam-clarey commented 7 years ago

Just out of curiosity, could this be done in a week or so if i were able to sponsor some of the dev work?

takahirox commented 7 years ago

Well, I can't promise but I'll try. Do you have any specific models data you can share? Wanna work with them as reference.

adam-clarey commented 7 years ago

testfile.fbx.zip This is similar to what we need if it helps

mrdoob commented 7 years ago

In the meantime...

For https://with.in/watch/under-neon-lights/ we used plain-text FBX but we changed the extension to .fbx.txt so the server would gzip it. I also optimised quite a lot the FBXLoader2. It ended up being a pretty decent workflow.

I wonder if there is anythingFBXLoader supports that FBXLoader2 doesn't or we can replace it already...

@kyle-larson?

Mugen87 commented 7 years ago

Side note: The FBX example already uses FBXLoader2, too.

Kyle-Larson commented 7 years ago

@mrdoob The only difference between the FBXLoader and FBXLoader2 is the use of Index buffers. FBXLoader2 does not use index buffers. Other than that, FBXLoader2 should include all the features of the previous loader.

mrdoob commented 7 years ago

Ah! Time to replace it then 👌

adam-clarey commented 7 years ago

Is there any update on this guys? Happy to help out where I can.

takahirox commented 7 years ago

Do you have a text file version of testfile.fbx.zip? I wanna compare.

adam-clarey commented 7 years ago

testfile_ascii.fbx.zip

takahirox commented 7 years ago

Binary parser progress...

image

@adam-clarey

Can you share the screenshot of the model? Even the text file couldn't be loaded on the Three.js.

takahirox commented 7 years ago

Another model's screenshot....

image

Model: https://free3d.com/3d-model/robot-2162.html

mrdoob commented 7 years ago

Looking good! 😀

RicoLiu commented 7 years ago

Thank you all!

adam-clarey commented 7 years ago

I'll try and upload a screenshot soon. Essentially my use case is being able to bundle in material images and model into a single file

adam-clarey commented 7 years ago

block.fbx.zip

screen shot 2017-05-05 at 15 19 12

Here is a simple block with an image material baked into the fbx with an accompanying image of what it looks like in blender

takahirox commented 7 years ago

You mean, the texture image data should be in the fbx file?

adam-clarey commented 7 years ago

Yes. I may have exported that model incorrectly

takahirox commented 7 years ago

I can't find the image data in the fbx binary data... Let me know if anyone knows baked texture image data specification.

adam-clarey commented 7 years ago

maybe try this one block2.fbx.zip

takahirox commented 7 years ago

Still can't find... Are those files be loadable on other viewers?

Please let me know if anyone knows baked texture image data specification.

jostschmithals commented 7 years ago

I just tried to open block2.fbx.zip with blender and with 3ds max. Both show only the filename, but no image. It seems that there is only the reference to .../Users/adamclarey/Documents/burger-screen.jpg in the file.

takahirox commented 7 years ago

Yup, my parser extracts the file name but no image data.

adam-clarey commented 7 years ago

Ok. I'm obviously doing something wrong. Blender isn't the most intuitive app to use. I'll try something else

jostschmithals commented 7 years ago

I never heard that image data could be baked into a 3D export/import format (but only relative paths to the ressources).

Is this even possible?

jostschmithals commented 7 years ago

I just noticed: it is possible.

I will create such a test file and post it here.