gpt4 book ai didi

three.js - 如何使用three.js编写正确的重复纹理

转载 作者:行者123 更新时间:2023-12-04 02:07:54 25 4
gpt4 key购买 nike

我搜索在模型上重复纹理。在所有示例或问题中,我发现只有这样:

var lavaTexture = THREE.ImageUtils.loadTexture( 'images/lava.jpg' );
lavaTexture.wrapS = lavaTexture.wrapT = THREE.RepeatWrapping;
lavaTexture.repeat.set( 3, 3 );
var lavaMaterial = new THREE.MeshBasicMaterial( { map: lavaTexture } );

我明白这一点,但是当 Material 是这样写的:
Wood: new THREE.MeshPhongMaterial( {
color: 0xffffff,
specular:0xffffff,
shininess: 10,
map: new THREE.ImageUtils.loadTexture ( "models/macabann/chataigner.jpg"),
// not sure as right
WrapS : THREE.RepeatWrapping,
WrapT : THREE.RepeatWrapping,
maprepeat : [2,2],

envMap: textureCube,
combine: THREE.MixOperation,
reflectivity: 0.05
} )

如果可能的话,我会搜索如何以这种格式准确地写出这个。
感谢您提供任何答案。

最佳答案

你想要一个纹理在你的模型上重复。为此,请遵循以下模式:

var loader = new THREE.TextureLoader();

var texture = loader.load( 'myTexture.jpg', function ( texture ) {

texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
texture.offset.set( 0, 0 );
texture.repeat.set( 2, 2 );

} );

var material = new THREE.MeshPhongMaterial( {

color: 0xffffff,
specular:0x111111,
shininess: 10,
map: texture,
. . .

} );

编辑:更新为three.js r.84

关于three.js - 如何使用three.js编写正确的重复纹理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14114030/

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