如何用 2 种不同的材料给 scnplane 上色?

How to color a scnplane with 2 different materials?

我在 SceneKit 编辑器中创建了一个 SCNPlane,我希望平面的一侧具有特定图像,而平面的另一侧具有另一图像。我如何在 Scenekit 编辑器中做到这一点

到目前为止,我尝试做的是向平面添加 2 种材质。我尝试添加 2 种材料并取消选中 double-sided,但这不起作用。

如有任何帮助,我们将不胜感激!

根据 SCNPlane 文档:

The surface is one-sided. Its surface normal vectors point in the positive z-axis direction of its local coordinate space, so it is only visible from that direction by default. To render both sides of a plane, ether set the isDoubleSided property of its material to true or create two plane geometries and orient them back to back.

这意味着一个平面只有一个 material — isDoubleSided 是 material 的 属性,让那个 material 在两侧渲染一个表面,但是您无法将一个 material 变成两个。

如果你想要一个有两个 material 的平面,你可以按照文档的建议将两个平面背对背排列。使它们成为包含节点的子节点,然后您可以使用它来将它们移动到一起。或者,您也许可以制作一个在一维空间中非常薄的 SCNBox