Three.js Error: no keyframes in track named [objectname].position - three.js

Exporting from Blender this animation in three.js format i get this error: "Error: no keyframes in track named Mesh.position". The Blender file have all the orphan data purged. I noticed that at bottom of exported json file there's a section with a empty animations:
"animations":[{
"tracks":[{
"type":"vector3",
"name":"Mesh.position",
"keys":[]
},{
"type":"vector3",
"name":"Mesh.scale",
"keys":[]
},{
"type":"quaternion",
"name":"Mesh.quaternion",
"keys":[]
}],
"name":"default",
"fps":30
}]
If removed all worked correctly: it's a bug in the exporter or some parameters that i missing in the Blender file?
Parameters used for exportation:

Related

How do I convert an .fbx file from blender to .dae file for Xcode SceneKit

I am trying to convert an .fbx file to a .dae (Collada) file. I have tried using an application for this called FbxConverterUI, however when I drag the Collada file into Xcode it doesn't load all of the animations, meshes and textures from the .fbx file. I use Blender to create the .fbx file. I did try to export it in Collada format from Blender however only a single animation loaded with multiple copies of that one, the animation was also different than how I keyframed it so I bumped into exporting it in .fbx which was loaded correctly when I imported it back into Blender to check that the .fbx format would work.
I lastly tried to export it in usdc and obj but I wasn't bothered with obj because it filled my desktop with like 100 files, the usdc didn't work either because there was not textures or colour and no animations, just a white mesh.
If you could explain how I could convert .fbx to Collada with all of the animations, textures and mesh stays the same that would be great. Or if there is another way to export it in Collada (from Blender) with it working properly. Any other methods that work which you suggest me do would be amazing.
Thanks.
In case you need some kind of guidance, this are my "prefered" export settings from Blender (v.3.0) when it comes to animated models - and I usually had success with it. I am using a separate DAE File for the Model, including the rig - and for the animations I create separate DAE files, containing only the animation, that can be applyed to the node containing the rigged model using SCNAnimationPlayer. (do not convert the those type of DAE files to SCN files using XCode - this may break the file in some cases)
There are many more settings to tweak. (in my example picture anything else is left default)
Keep in mind: This is for SceneKit. For other rendering engines, things may vary.

Blender export to three.js. All matirials have the same grey color

I'm playing around with some open source 3d models and when I'm trying to export them to three.js json format, all materials are exported in same grey color.
How model looks like in blender (you can see that all materials have different colors)
How the result looks like
So inside the exported json file all materials have the same color:
[{
...
"colorSpecular":[0.5,0.5,0.5],
"colorDiffuse":[0.64,0.64,0.64],
"colorEmissive":[0,0,0],
...
"DbgName":"HullPlain.002"
},{
...
"colorSpecular":[0.5,0.5,0.5],
"colorDiffuse":[0.64,0.64,0.64],
"colorEmissive":[0,0,0],
...
"DbgName":"HullColor.002"
},...]
here my export settings
I tried different models and I'm getting the same materials settings "colorSpecular":[0.5,0.5,0.5], "colorDiffuse":[0.64,0.64,0.64], for all of them.
Does anyone knows what can cause this issue? Thanks!
The three.js JSON exporter does not support Cycles node materials, and generally that exporter is no longer recommended.
I would suggest using KhronosGroup/glTF-Blender-Exporter and THREE.GLTFLoader instead. It supports Cycles Render, but only if you use the provided PBR nodes. For an easier setup process, use the default Blender Render materials. A quick conversion (I was not careful about getting the right colors) shows this working for your models:
^Note that you will need to apply modifiers before export, or in the export settings.
three.js r92

convert .obj and .mtl file with multiple materials to json

I have a .obj, .mtl files with multiple materials
for a specified material, I want to print the vertices and their corresponding uv coords.
Is there a way to e.g. parse a .obj, and .mtl file and export them to json?
When using
wavefront-obj-parser
PyWavefront
meshlab
All these tools generate a json file I think that the data is partial - I don't see the materials in there.
EDIT:
I tested with an example 3d model
step1: converted the .obj and .mtl with multiple materials into a .json file
Added the addon to Blender (version 2.76b) as instructed in here
In Blender, imported the .obj, .mtl (the model shows up but not the material textures)
In Blender exported to Three.json (see here)
step2: loaded the generated .json file (foo1.json) within a threejs example
Used the example webgl_loader_json_objconverter.html from here
Replaced Female02_slim.js with foo1.json
The model Male02_dds.js is loaded but the foo1.json is not and I'm getting an error message: TypeError: vertices is undefined
Some links indicate that Blender Exporter and Json File Loader are not so reliable (see here, here, here, and here in general)
Is there any other converter from .obj, .mtl to .json that anybody can recommend? (not necessarily in relation to three.js)
Assuming that I can convert to glTF format, is there a tool, (e.g. a command line utility in python) that will let me specify a material index and get the vertices and corresponding uv coords for this material?
Solved:
I ended up using meshlab plugin export to json. It works (almost) fine for me
Sure, you can use Blender and THREE JS plugin (exporter):
https://www.blender.org/
https://github.com/mrdoob/three.js/tree/dev/utils/exporters/blender
Exported file have materials as array if you use JSON Loader function
https://threejs.org/docs/#api/loaders/JSONLoader

Exporting from Blender to Three JS with materials intact on scene

I'm struggling to get an exported scene from blender into three.js and have been researching and experimenting for about two weeks now, however all information I can find on the subject seems to date back several years and is now too out of date to be of use.
I'm working with the following
Blender: 2.7.7
Blender Threejs export: 1.5.0
Three.js: r76
I've tried a few hundred combinations of export settings and while I can always get the geomety exported correctly, the materials while referenced correctly as far as I can see in the JSON file do not seem to want to load in. This occurs with both embeded and referenced textures.
While I have plenty of code samples for loading in JSON with the ObjectLoader all the images, references I find are to much older versions of the exporter (which I have tried) and I've yet to find one thta contians materials, the closest I found was a blender export with colours.
If anyone has any resources for the exporter or the object Importer, or would be able to see any issues with the JON file t would be a great help. The documentation and resources I can find are rather thin on the ground for the newer versions of ThreeJS it seems.
Here is a sample of the exported JSON https://paste.ee/p/RH42a I encoded the textures on this one. For some reason it's also exporting upside down, but that can be easily fixed.
Object loader
var loader = new THREE.ObjectLoader();
loader.load('obj/test/blender/export/test.json', function(obj) {
scene.add(obj);
});

Unable to import a blender scene into three.js

I'm trying to import the simpliest Blender scene (camera included) into three.js, but whatever set of options I mark when exporting I always get an exception (data is undefined) when doing the "loader.parse" of the file content (a json string or event an already parsed object) and nothing is shown.
What can be wrong? Is it a bug?
Im using the latest threejs version from github and blender 2.72.
This is what the console.log of the JSON parsed file looks like:
Object { urlBaseType: "relativeToScene", metadata: Object, objects: Object, geometries: Object, materials: Object, embeds: Object, transform: Object, defaults: Object }
Thanks!
I have inspected the code step by step and it seems that the Blender plugin is outdated, the expected data structure at many points for the current version of three.js loaders is quite different then tue data structure returned by the plugin.
EDIT: It's already working in the dev branch! :D
enter link description here

Resources