I'm experiencing picking problems when loading a collada model in ThreeJS. The picking example for cubes works fine. Loading a collada model works as well.
However it seems that for picking collada object I need to pick well above the 3D object. As picking works for the cube I cannot figure out why it is not working for collada objects (export from SketchUp). Does anyone have a good example where it is possible to load a collada model and pick the individual objects? Thanks in advance.
Related
We have an issue with exporting our 3D Assets and animations correctly so that three.js can correctly display them.
All our 3D artists work with Cinema4D so we need to go through blender to export a three.js compatible JSON. They export the scene as FBX and then import it to blender. This seems to work fine. The model looks good there (with Material View set in Preview Window) and the simpler models we exported even worked with textures and animations.
But we now have a scene where, when we load the resulting JSON, some of the meshes are flipped 180° (but only some - the trees) and one of the models (Santa model) is not textured. They all look fine in blender.
When loading the JSON in https://threejs.org/editor/ you will immediately see the issues:
Is this an export problem? Can we fix it by tweaking the export params? Will we need to adjust the model in blender?
I would advise a couple things here:
File a bug on three.js including the .blend file
Try freezing transforms in Blender or C4D before export
Perhaps try a different three.js-compatible blender exporter, like glTF-Blender-Exporter.
I'm new to both Blender and ThreeJs and searched a lot before asking. I created a model with Blender and esported it as .dae so I can load it in the html canvas. The problem is that only the model is loaded and not the textures. I'm doing something wrong or it's the loader that somehow causes the problem?
Here is the sample:
http://provasitimek.herobo.com/firstImport2.html
and the code:
https://github.com/MarcinKwiatkowski1988/learningThreeJs/tree/master/ThreeJs_and_blender
PS. the blender version is 2.70 (so maybe the problem lays here?)
PS2: So, after many attempts, these are my conclusions:
to get the color of the object, you have to choose the Blender renderer and not Cycles renderer
the export to the file .dae is not realy significant, should working with all options (or at least I didn't find any differences between files exported with different options)
if you use Blender renderer and any basic materials (Basic, Lambert, Phong) you get only the color on the object rendered in threeJs: so, for example, if you apply a trasparency to you object on blender, you will not see it on the rendered object on threeJs
with my current level (i just started to learn threeJs and blender 2 weeks ago) this is as far as I can help. Hope someone with higher skills like #mrdoob would figure out what the problem is
THREE.js does not pair models and textures until you actually make a mesh. Export The model and texture separately, load them separately and call
new THREE.Mesh(blenderGeometry,blenderTexure)
I load collada models, exported via Google Sketchup, into my Three.js (v63) scene with the Three.js collada loader.
The models are loaded, but with some, textures aren't well mapped, like in the following picture :
My first question is how to detect this kind of problems and then, is there a way to leverage the exported UVs from sketchup to correctly map the textures ?
The model from the sceenshot comes from : http://sketchup.google.com/3dwarehouse/details?mid=557d5f1b5a076bdcf53b1b21212345ca&prevstart=0
I have a 3D model stored in OBJ file format. I can load the OBJ file using the OBJLoader just fine.
The model renders correctly and material applied correctly.
What is missing is the loading of polygon groups defined in the OBJ file to identify certain areas in the Model to be able to apply different materials over it.
When I look into the OBJLoader source, I found that it ignores the loading of the polygon groups segments.
How can I read the polygon groups using the OBJLoader and create additional child mesh objects to assign to the parent Model Object3D?
I found a workaround to solve this problem
Download the open source 3D modeling application Blender and install it.
Open your OBJ files using Blender.
Export the OBJ model to another format, I used Collada format which works for me
Use the THREE.JS Collada loader
Collada loader will load the object model and its groups and materials successfully.
Hope this help you guys
I have experimented with the example COLLADA parser colladaloader.js and imported a skeletal animated collada model "Seymour_anim2.dae" from http://collada.org/owl/browse.php?sess=0&parent=131&expand=0&order=name&curview=0 using mrdoob.github.com/three.js/examples/webgl_loader_collada.html and http://mrdoob.github.com/three.js/examples/webgl_animation_skinning.html as an example. The loader seems to parse and store the skeleton structure and some skeletal animation data either in collada.animations or collada.dae.animations. The problem is that I can't get the skeletal animation to work using the methods in the examples.
Now, I'm wondering is there something wrong with the COLLADA parser, or are there some other methods/tricks in Three.js that could be used to play the skeletal animation of my model? I'd love to hear if you have any ideas how this could be done neatly in Three.js or is this even possible yet.
Edit: I have now also tested the model with GLGE framework and it loads, renders and animates it correctly. However, it would be very good to have skeletal animation for COLLADA model in Three.js because developing with GLGE is too time consuming and troublesome and GLGE is quite inactive project compared to Three.js. Skeletal animations are important for increasing immersion in a virtual world.
I've myself given up on Collada and went on using the included OBJ loader.
But halfway through I've found one thing that might be worth testing out.
There seems to be an alternative Collada loader, here: github ColladaLoader2.coffee
Hopefully it works somewhat better. Please let me know :)