gpt4 book ai didi

javascript - 如何将纹理应用于 THREE.ExtrudeGeometry?

转载 作者:行者123 更新时间:2023-11-27 22:34:39 25 4
gpt4 key购买 nike

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 );

纹理 (512x512):http://f3.s.qip.ru/cMfvUhNj.png

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

如何填充纹理图形?

最佳答案

如果您只有一条直线挤压路径,则可以将纹理应用于挤压形状,而无需自定义 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]));

这对于千篇一律的形状很方便。

关于javascript - 如何将纹理应用于 THREE.ExtrudeGeometry?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14797407/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com