mrdoob / three.js

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

Exported Collada file crashes Blender and Sketchup #17280

Closed marekjedrzejewski closed 5 years ago

marekjedrzejewski commented 5 years ago
Exported Collada file crashes Blender and Sketchup

Problem can be seen even with example in documentation: https://threejs.org/examples/?q=collada#misc_exporter_collada

I tried several different 3d programs and Modo, Max, Maya and Archicad handles exported file just fine, Blender and Sketchup crashes and SweetHome3d just refuses to import the model. I worked around it by adding profile="" to technique in extra in generated file and Blender and Sketchup imports it fine now.

        <extra>
          <technique>
            <double_sided sid="double_sided" type="int">1</double_sided>
          </technique>
        </extra>

I don't know if that's not breaking something elsewhere, but from what I've seen it's fine. SweetHome3d still doesn't import it, but I don't know how to debug it as nothing comes up in console.

Three.js version
Browser
OS
Mugen87 commented 5 years ago

/ping @gkjohnson

gkjohnson commented 5 years ago

I worked around it by adding profile="" to technique in extra in generated file and Blender and Sketchup imports it fine now.

It looks like profile is a required attribute for <technique> in the spec (see page 5-122) so we should probably add that to the "technique" node.

This wiki on Collada extension describes "profile" as the platform or application that the extra information is relevant to but double sidedness is pretty general. Issue #2280 gives examples of "MAYA" and "GOOGLEEARTH". Maybe we should just export "THREEJS"? It looks like profile is not allowed to be empty.

        <extra>
          <technique profile="THREEJS">
            <double_sided sid="double_sided" type="int">1</double_sided>
          </technique>
        </extra>
Mugen87 commented 5 years ago

Maybe we should just export "THREEJS"?

As far as I understand the spec, the value can be arbitrary. So THREEJS sounds good to me.

gkjohnson commented 5 years ago

@marekjedrzejewski Can SweetHome3d load the file if the profile field is set to a non-empty string?

marekjedrzejewski commented 5 years ago

@marekjedrzejewski Can SweetHome3d load the file if the profile field is set to a non-empty string?

Unfortunately not, I think it's not connected to technique tag. I also tried to remove whole extra before, which loaded fine in blender and sketchup too, but sweethome3d also didn't work with this. I will try with some really simple models tommorow, cause collada exported from blender works. If I'll use something simple, then it would be easy to see differences berween the one from blender and one from threejs.

gkjohnson commented 5 years ago

@marekjedrzejewski

Okay -- I'm unfamiliar with SweetHome3d but feel free to open another issue if you find more details on what's causing the problem.

For reference here are the Collada loader source for that project:

Java https://github.com/svn2github/sweet3dhome/blob/master/trunk/SweetHome3D/src/com/eteks/sweethome3d/j3d/DAELoader.java

Javascript https://github.com/svn2github/sweet3dhome/blob/e2aee4fb844ba4ddd768cfcd6f0e55c53f1a4063/trunk/SweetHome3DJS/src/DAELoader.js

marekjedrzejewski commented 5 years ago

Found it. It's problem with empty names. I opened pull request here: https://github.com/mrdoob/three.js/pull/17291