ColladaLoader fails with objects containing mixture of textured and non-textured materials
See original GitHub issueSTEPS TO REPRODUCE
- Launch Google sketchup
- Draw rectangle
- Texture just the top surface
- Export as DAE
- Load into three.js editor (drag file to http://mrdoob.github.io/three.js/editor/)
The object is not displayed and firebug stops on an error:
WebGL: DrawElements: bound vertex attribute buffers do not have sufficient size for given indices from the bound element array
Line 450
DEBUGGING
The problem may be related to the UV coordinates.
In SetMeshBuffers there is the code:
if ( dirtyUvs && obj_uvs && uvType ) {
for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) {
fi = chunk_faces3[ f ];
uv = obj_uvs[ fi ];
if ( uv === undefined ) continue;
The code spots that obj_uvs is an array with 2 entries, but fi is the number 2, so accesses the array out of bounds and the uv==undefined condition is triggered.
I suspect the problem is actually in ColladaLoader. My suspicion is that faceVertexUvs are only written for faces using a textured material and so the obj_uvs array is too short but I can’t quite understand the details.
WORKAROUND
Using textures for all sides of a model fixes the problem.
Issue Analytics
- State:
- Created 10 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
javascript - Three JS | Collada loader textures - Stack Overflow
I receive dae model with all textures from backend. After, i parse images (textures) and create materials array. let materials = []; textures....
Read more >texturing - Problem with exporting a proxy object (to collada ...
No textures / materials will be copied to the destination. The animation doesn't work, because it seems like the "Body" object is not...
Read more >How to Texture Walls - The Home Depot
Learn how to texture a wall with a roller and other common supplies. ... It does not contain sand or other materials to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

As requested, the carpet jpg
The current version of
ColladaLoaderdoes not parse the file correctly. It is able to setup the multiple materials and the respective groups of the buffer geometry but it can handle the definition ofuvcoordinates of thedaefile.That’s the problematic section:
Each
polylistresults in agroupwith the respective material index. The firstpolylisthas no uv-coordinate (TEXCOORD) definition. But the second one. And that’s the problem. As @crobi suggested, we need to fill default values to the uv buffer for the first polylist.@mrdoob Unfortunately, it looks like we need a more comprehensive refactoring to enable this feature. I’ll try to code something so we can better see the scope of this change.