设想情况:
a.我在3ds max中有一个默认的球面。
我在X轴上缩小了10次,然后出口到obj.
把缩小的球体导入3JS,然后再放大X 10次。
我想让球体看起来像步骤A-在它被缩小之前-我需要保持输入的顶点法线,而不是在3JS中计算
____
问题:
JsFiddle演示:
(球面只是为了简化样本,通常可以是任何网格)
原因:
我想对进口的非制服网进行缩放,以不同的形状重复使用它。
请给我一些关于如何解决这个问题的建议。每一个想法都是非常感谢的!
发布于 2017-08-28 20:05:39
那是因为你的法线在x方向上都压扁了。您必须深入挖掘BufferGeometry
的属性,并手动“拉伸”这些法线:
尝试用以下代码替换JSFiddle中的JSFiddle回调:
document.getElementById("scaleButton").onclick = function(){
object.scale.set(10,1,1);
// Get the 'normal' attribute of the geometry
var normals = object.children[0].geometry.getAttribute("normal");
// Manually stretch the x-value of the normal by 10
for(var i3 = 0; i3 < normals.length; i3 +=3){
normals.array[i3] = normals.array[i3] * 10;
}
// Inform the renderer that the attribute was altered
normals.needsUpdate = true;
}
工作JSFiddle
https://stackoverflow.com/questions/45891506
复制相似问题