在模型的另一侧可见三JS网格 [英] Three-JS Mesh visible on opposite side of model
问题描述
所以我使用的是在搅拌器中为ThreeJS制作的自定义模型。我将它导出到.obj文件并使用Three-js转换实用程序生成json文件。我把它设置为旋转,当它旋转时,你可以看到模型的另一面。
这是我用来加载它的代码:
So I'm using a custom model made in blender for ThreeJS. I exported it to a .obj file and used the Three-js conversion utility to make a json file. I have it set to rotate, and as it rotates, you can see the other side of the model. This is the code I'm using to load it:
loader.load("pegnin.js", function(geometry, materials){
material = new THREE.MeshPhongMaterial( {
color: 0xff0000,
polygonOffset: true,
polygonOffsetFactor: 1, // positive value pushes polygon further away
polygonOffsetUnits: 1
});
material.depthTest = true;
mesh = new THREE.Mesh(geometry, material);
scene.add(mesh);
});
推荐答案
three.js假设前脸有逆时针绕线顺序。换句话说,three.js中的前脸由面部的缠绕顺序决定 - 而不是面部正常。
three.js assumes that front-faces have counter-clockwise winding order. Stated another way, the front-face in three.js is determined by the winding order of the face -- not the face normal.
可能是正面在您的模型中有顺时针缠绕顺序。
It is likely that front-faces in your model have clockwise winding order.
不需要您更改模型的解决方法是设置:
A work-around that does not require you to change your model is to set:
mesh.material.side = THREE.DoubleSide;
three.js r.85
three.js r.85
这篇关于在模型的另一侧可见三JS网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!