mrdoob / three.js

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

Collada Loader: nothing displayed at all #747

Closed boombaby closed 12 years ago

boombaby commented 13 years ago

Hi guys,

I just discovered three.js about a week ago and whoa... what a great great toolset! I´ve been dreaming about something like this for a long time, the possibilities are just... well, whoa again :-) Congrats, excellent job!

Well, since I downloaded the latest version I´ve been playing around with the possibilities, including the awesome collada import. Now I stumbled about a really strange problem, I hope you have a hint for me in which direction I could investigate:

All the available example files of the collada loader work fine for me (monster/koi-skin/demom). But when I try to use my own files ( biped animations, skinned, created in 3ds Max 2010), nothing is displayed at all. Not even the stats or the grid will show up, just blackness. (well, yes, the paths are set correctly..)

Simple scenes with basic geometry and without animation exported as dae - no problem. But as soon as I attach a modifier like skin or physique to the model and export it via OpenCollada: nothing - no matter what parameters I use for the export. Though I saw that e.g. 6ert´s koi-file was exported via OpenCollada as well... hm.

I don´t think that this is a Max/OpenCollade-issue, my files can be re-imported as dae into max, and they work - just like e.g the monster.dae, which I can load into max and watch it crawling around in my viewport. So the file structure of my dae´s seems to be basically ok....

So my first question is: is anybody out there who succesfully exported a collada file out of 3ds Max with animation and material and used it with the collada loader? I opended the working example files in an editor and compared them to mine, and at first glance they seem to have the same structure...

Any idea what I am doing wrong or where I overlooked something? I hope this question is not too stupid - I´m more a graphics designer than a code genius... Basically, it seems like the collada loader requires some special specifications of the dae file that my files don´t meet. Could you tell me which specs these are?

mrdoob commented 13 years ago

If you have a simple file that doesn't work, feel free to share and I can take a look at it (the simpler the better).

boombaby commented 13 years ago

Thanks for the quick reply! Okay, I attached the most simple (and therefore ugliest :-)) example I have; 2 polygon boxes attached to the calf and the thigh of a very simple biped, performing 15 frames of animation, no material texture or whatsoever; exported with OpenCollada. The file can be flawlessly re-imported into Max (using the OpenCollada import) and into Blender (via native DAE import), structure and animation still working fine. When I try to display it through the loader in webgl_collada.html (the original one as well as the modification by 6ert) I have a black screen, no stats, no grid, it will simply not start up. The other (local) dae example files display immediately. Comparing the structure of the example files and this one doesn´t show anything suspicious for me, but as I said, I am far from being a code expert...

boombaby commented 13 years ago

Whoops, I attached the file to the mail, which makes no sense here... Here is it: http://www.boombaby.eu/xperimental/2boxes.rar

mrdoob commented 13 years ago

Oh, having animation makes it more complex :) But does a DAE exported from Max without animation work fine? Animation is still pretty beta in the engine.

6ert commented 13 years ago

see patched examples at https://github.com/mrdoob/three.js/issues/746 in plus you may edit the 2boxes.DAE 'animation' tag in 'library_animations' and change it to sth like 'animation id="node-Bip"' and try again. 6reets - 6ert

boombaby commented 13 years ago

@mrdoob: Oh, sorry :-) I think I didn´t put this clearly enough; it´s only a problem when things become animated. As long as I use sheer dae objects without animation, everything works fine!

@6ert: Yes, I saw and downloaded the patched version already, very cool work indeed! .....& about the modification of the animation tag that you suggested; Holy Collada Batman!! This worked! How the heck did you figure that one out?! Is this an OpenCollada bug or is it just that the three.js-loader needs this additional information in order to work properly? My more sophisticated models still don´t work with this trick, though. But at least now I know where to start searching, I will have some fun comparing my non-working models against the ones that work :-) Your OpenCollada exported example models all work perfectly, do you have other "secrets" like the animation tag thing that made them work so smooth?

Anyway, thanks for sharing this piece of black magic :-)

boombaby commented 13 years ago

Argh, the github interface is still not my cip of tea... In fact I didn´t want to close this, maybe we can gather more interesting input on this?

6ert commented 13 years ago

yes - seems to be opencollada bug (spec says: id required) and no - no secrets, (I noticed it by interpreting console log) further I like to pronounce mrdoob wrote - collada loader is still pretty Beta! so I spent some time to fix the multi/sub object problem concerning animation, which needed some code modifications in colladaloader.js @mrdoob dont know if you like to merge it in the R45 Three.js? But thats really complex stuff, I'm not that guru and TimKnip seams to be very busy... Maybe you can give a link to your non working models to give them a try?

6ert commented 13 years ago

corrected yes: -( collada spec says id optional - three.js-loader needs this additional information in order to work properly :-)

boombaby commented 12 years ago

Ah, okay, I see! Well, I am really still amazed by the fact that you found that out :-)
As your examples prove that it works, I really think it should be incorporated into the next version... I think having the possibility to easily import 3d formats into three.js would really be a marvelous feature for this great piece of code.

Yeah, the loader is still in its beta phase, but that´s what I am like; I see some examples that work and think to myself "Well, if it works for the others it will work for me", and then I find myself in unknown territory :-) I spent a lot of time recently looking at my models from their very inside... Oh, if anyone is interested to have a look at another non-working model, this time more sophisticated, feel free to take this one, for example:

www.boombaby.eu/xperimental/walkingwoman.rar

This is a female walkcycle, the model is covered with a simple checker texture (didn´t find the time to finish the real texture yet). This is one of the cases that I don´t understand at all. This dae imports wonderfully in 3ds Max and Blender, but when I try to display it in three.js, nothing. Unfortunetaly modifying the animation tag will not change anything either. Before putting the checker on the model, it had a multi/sub material... but I deleted this material from the model and didn´t export it, so this could not be the problem, could it?

6ert commented 12 years ago

still missing the id="node" in the animation tag at ln 642.in your file which results in error. Further you might have the missing texture ./images/checker.jpg in your local path (which I replaced by dummy). Afterwards I got no problem loading the file - smooth going 8-)

boombaby commented 12 years ago

6ert, you´re a genius!! :-)) Yes, it works now! Strange, I already modified the file before and it didn´t work - maybe I made a spelling error then..... And yeah, I forgot to put the jpg into the zip, I am really a little chaotic sometimes... Thanks a million, you cannot imagine how much this helped me!! The other files I have now work as well, fantastic! I`m in awe :-) So basically the loader needs a modified animation tag and everything works fine. I´m not sure, does this mean we can close the issue?

mrdoob commented 12 years ago

At this point is confusing to me whether this something that needs to be added to the ColladaLoader or not...

Could someone sum up the issue? :)

boombaby commented 12 years ago

Yeah, that´s why I wasn´t sure to close the issue, either :-) Basically, 6ert found out that my animated models didn´t work because there is an "animation" tag in the collada code that defines the start of the animation. This tag can be given the name of the animated biped if you want, but it doesn´t have to, it´s an optional feature according to the collada specs. When it doesn´t have this name, it will work in the usual 3D programs, but not in the three.js loader. When it has a name, everything is fine. Don´t know if this can be changed in the loader, though...

mrdoob commented 12 years ago

Thanks for the example file! Got it fixed in the dev branch :)