从Blender加载Three.js中的多个对象 [英] Loading multiple objects in Three.js from Blender
问题描述
我有一个非常复杂的形状(打扮的女孩),在Blender中将其分解为不同的对象,并使用JSON加载程序(我做了一点技巧,使用压缩文件而不是JSON文件)将其加载到Three.js中. ,因为有很多顶点).
I have a quite complex shape (dressed girl) that in Blender is broken down into different objects and it's loaded into Three.js with the JSON loader (with a little hack I made, that uses zipped files instead of just JSON files, as there are a lot of vertices).
当我想从网页上动态更改连衣裙的样式时,我想知道如何在场景中显示/隐藏不同的部分(例如袖子).
As I want to change dynamically the style of the dress from a Web page, I was wondering how I can show/hide different pieces (e.g. sleeves) in the scene.
我尝试遍历THREE.Mesh
,但是没有孩子.
I tried traversing the THREE.Mesh
, but there are no children.
当我使用JSON导出器从Blender导出时,看不到任何引用JSON中对象名称的信息.结构丢失了吗?
When I export from Blender with the JSON exporter, I don't see anything referring to the names of the objects in the JSON. Is the structure lost?
推荐答案
如果您正在使用包含大量顶点的网格,我建议您使用openCTM webGL加载程序,而不要使用zip hacking.这是加载程序的链接: http://threejs.org/examples/webgl_loader_ctm.html
此网状压缩工具使用LZMA压缩方法,可以将文件大小减少93%...
If you are using meshes containing lots of vertices, I would advise you to use the openCTM webGL loader instead of zip hacking. Here is a link to the loader : http://threejs.org/examples/webgl_loader_ctm.html
This mesh compression tool uses LZMA compression method and can reduce the size of your files by 93%...
关于JSONLoader,使用数组可能会有所帮助:
Concerning the JSONLoader, using an array might help:
var meshes = [];
...
var loader = new THREE.JSONLoader();
var onGeometry = function(geom)
{
var mesh = new THREE.SceneUtils.createMultiMaterialObject(geom, [material]);
meshes.push( mesh );
...
scene.add(mesh);
};
loader.load("yourfile.js", onGeometry);
希望这会有所帮助
这篇关于从Blender加载Three.js中的多个对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!