2013-02-10 78 views
2
var arcShape = new THREE.Shape(); 
arcShape.moveTo(50, 10); 
arcShape.absarc(10, 10, 40, 0, Math.PI*2, false); 

var map1 = new THREE.ImageUtils.loadTexture('moon.jpg'); 
var geometry = new THREE.ExtrudeGeometry(arcShape, extrudeSettings); 
var new3D = new THREE.Mesh(geometry, new THREE.MeshBasicMaterial({ map: map1 })); 
new3D.receiveShadow = true; 
obj3Dmassive.add(new3D); 

纹理(512×512):http://f3.s.qip.ru/cMfvUhNj.png如何将纹理应用于THREE.ExtrudeGeometry?

结果:http://f3.s.qip.ru/cMfvUhNh.png

如何填写纹理人物?

+0

请参阅http://stackoverflow.com/questions/7919516/using-textures-in-three-js – 2013-02-10 12:48:49

+0

@RachelGallen,... THREE.ExtrudeGeometry ............... – MixerOID 2013-02-10 13:16:24

回答

1

编辑:回复过时。改为参见Extruding multiple polygons with multiple holes and texturing the combined shape


很幸运。你所要做的已经在下面的例子中完成:

https://github.com/mrdoob/three.js/blob/master/examples/webgl_geometry_extrude_uvs2.html

你必须指定自己的紫外线发生器功能。这个例子告诉你如何做到这一点。

请记住,这只是一个例子。它可能不正确 - 或者很容易在你的案例中实现。

1

如果您只有一条直线挤压路径,则可以将纹理应用到挤压形状而不需要自定义UV生成器。例如

var extrudeSettings = { 
       bevelEnabled: false, 
       steps: 1, 
       amount: 20, //extrusion depth, don't define an extrudePath 
       material:0, //material index of the front and back face 
       extrudeMaterial : 1 //material index of the side faces    
      }; 

var geometry = shape.extrude(extrudeSettings); 

var mesh = new THREE.Mesh(geometry, 
    new THREE.MeshFaceMaterial([materialFace, materialSide])); 

这对饼干刀具类型的形状很方便。

相关问题