jMonkeyEngine 在网格内部应用材质?
我正在使用 jMonkeyEngine 开发桌面 PC 游戏。它仍处于早期阶段(总是开始,永远不会结束,是吗?)。
由于没有物理作用(仅移动相机),当您进入 内部时,面孔会消失几何模型。所以我的问题是,如何将材质(纹理)应用到网格内部?
I'm using jMonkeyEngine to develop a desktop PC game. It's still in early stages (always starting, never finishing, eh?).
With no physics (just moving the camera), faces disappear when you enter the inside of a Geometry model. So my question is, how do you apply a Material (texture) to the inside of a mesh?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看一下:
material.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off);
这应该显示两侧的纹理。如果您仅需要网格内部的材质,请使用 FaceCullMode.Front,尽管在这种情况下您可能应该重新定义网格,使其法线指向内。
Have a look at this:
material.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off);
This should show the texture on both sides. If you need the material only on the inside of your mesh, use FaceCullMode.Front, although in that case you should probably redefine your mesh instead so that its normals are pointing inwards.
由于大多数网格体没有“内部”,因此您无法使用相同的几何体来做到这一点,对我来说一个很好的解决方法是使用网格体的克隆,但尺寸为负,尽管这仅适用于对称网格体。
Since most meshes don't have an 'inside' you can't do it with the same geometry, a good workaround that worked for me was to use a clone of the mesh but with a negative size though this only works for symmetrical meshes.