UVテクスチャをthree.jsで正しくレンダリングするための助けが必要です。 Blenderでタイルテクスチャを繰り返すモデルを作成しました。タイルテクスチャはUVマッピングを使用して適用され、正しくレンダリングされている場合は次のようになります。 Render image using Blender 。ただし、JSONLoaderをthree.jsでロードすると、タイルは各ポリゴンを塗りつぶすだけで、結果はScreenshot of render using three.js です。私は私のコードでTHREE.RepeatWrappingを設定しようとしましたが、何も変わっていない:THREE.js JSONLoaderを使用してUVテクスチャを繰り返す
bodyLoader = new THREE.JSONLoader();
bodyLoader.load('./starofthesea_threejs.json', function(geometry, materials) {
mainBodyMaterials = new THREE.MeshFaceMaterial(materials);
console.log(materials);
mainBodyMaterials.wrapS = THREE.RepeatWrapping;
mainBodyMaterials.wrapT = THREE.RepeatWrapping;
mainBodyMaterials.needsUpdate = true;
mainBody = new THREE.Mesh(geometry, mainBodyMaterials);
mainBody.traverse (function (child) {
if (child instanceof THREE.Mesh) {
child.castShadow = true;
child.receiveShadow = true;
}
});
mainBody.scale.x = mainBody.scale.y = mainBody.scale.z = 1;
geometry.computeBoundingBox();
geometry.computeFaceNormals();
geometry.computeFlatVertexNormals();
scene.add(mainBody);
});
は、それが正しくレンダリング得るために私のコードで何か問題、または回避策はありますか?すべての援助は深く感謝しています。
ちょっと考えて、mainBodyMaterials.repeat.set(10、10)を設定する必要がありますか?テクスチャは2幅の高さにする必要がありますか? – Sentinel
マテリアルのリピートを設定するだけで「未定義」エラーがスローされ、テクスチャのすべてのディメンションはすでに2の累乗に設定されています – kychung