mrdoob / three.js

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

Collada Problem "p is null" #1052

Closed irenkai closed 12 years ago

irenkai commented 12 years ago

I am triying to do a simple Collada model loader based on the webgl_collada.html but I cant get it to load my files, I have tried with duck.dae and it works so Im guessing there must be wrong with the collada files but I cant seem to find it.

The javascripy console log from firebug says " p is null " , it's a collada file exported from google sketchup .

Here is the link to the .dae http://chorrillana.cl/test-3/models/test.dae

thx for any help

chandlerprall commented 12 years ago

The error is happening on this line in the collada loader. It has a problem with your model's ID12 effect's shader. The library_effects in your model start at line 2338. The first effect is ID6 which contains a lambert material, this is fine. However, the next effect - ID12 - uses constant which is not understood by the collada loader.

Removing the ID12 effect and the reference to it leads to another error with the materials, namely that many of them refer to material ID11 which doesn't exist. All in all it looks like your model's materials weren't saved correctly.

irenkai commented 12 years ago

And how could it be fixed, the original file is a 3d Max Model exported through OpenCollada, maybe use a diferent exporter?

chandlerprall commented 12 years ago

There is a 3dsmax exporter which has worked well for me - https://github.com/mrdoob/three.js/blob/master/utils/exporters/max/ThreeJSExporter.ms

irenkai commented 12 years ago

And a collada exporter that Works ? (the whole project is based around collada to manage 3d exports)....

Thx a lot for the help ... Im just getting into 3d .

chandlerprall commented 12 years ago

Apparently the DEV branch has an updated ColladaLoader which should fix the first issue you have, but I have doubts that it would solve the missing materials issues. Could give it a try and see.

The ColladaLoader is working, your dae file is technically invalid as it points to non-existent materials.