javascript Three.js:平面只有一半时间可见
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10889583/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Three.js: Plane visible only half the time
提问by Randomblue
回答by Chris
回答by GNi33
It's not visible because the backface of the plane does not get rendered (or better said, a plane doesn't have backfaces per default. On a side note, have a look at backface-cullingregarding this. Although it's not the issue in this case, it may give you a little insight about rendering).
它是不可见的,因为飞机的背面没有被渲染(或者更好地说,默认情况下飞机没有背面。顺便说一下,看看背面剔除关于这个。虽然这不是问题情况下,它可能会让您对渲染有一些了解)。
Three.js does give you a very easy way to render backfaces though.
Three.js 确实为您提供了一种非常简单的方法来渲染背面。
In Three.js - r49 and below:
在 Three.js - r49 及以下:
All you need to do is set the doubleSided
- property of your plane-Object to true.
您需要做的就是将doubleSided
飞机对象的- 属性设置为 true。
plane.doubleSided = true;
For newer versions - r50 and up
对于较新版本 - r50 及更高版本
In newer revisions, as donnyB already stated correctly in his answer, the property was moved from the Object3D
- object to the Material
- object, so you'd need to set it a little differently, like so:
在较新的修订版中,正如 donnyB 在他的回答中已经正确说明的那样,该属性已从Object3D
- 对象移动到Material
- 对象,因此您需要对其进行一些不同的设置,如下所示:
plane.material.side = THREE.DoubleSide;
Also edited your fiddle to show you: http://jsfiddle.net/VsWb9/1084/
还编辑了您的小提琴以向您展示:http: //jsfiddle.net/VsWb9/1084/
it is using a Three.js - version newer than r50, the property is set on line 35
它使用的是 Three.js - 比 r50 新的版本,属性设置在第 35 行