如何使用 2 种不同材料为 scnplane 着色? [英] How to color a scnplane with 2 different materials?

查看:58
本文介绍了如何使用 2 种不同材料为 scnplane 着色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have a SCNPlane that I created in the SceneKit editor and I want 1 side of the plane to have a certain image and the other side of the plane to have another image. How do I do that in the Scenekit editor

到目前为止,我尝试做的是向飞机添加 2 种材料.我尝试添加 2 个材料并取消选中 double-side 但这不起作用.

So far what I've tried to do is adding 2 materials to the plane. I tried adding 2 materials and unchecking double-sided but that doesn't work.

任何帮助将不胜感激!

推荐答案

根据 SCNPlane 文档:

Per the SCNPlane docs:

表面是一面的.它的表面法向量指向其局部坐标空间的正 z 轴方向,因此默认情况下它只能从该方向可见.要渲染平面的两侧,ether 将其材质的 isDoubleSided 属性设置为 true 或创建两个平面几何图形并将它们背对背定向.

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.

这意味着一个平面只有一种材质——isDoubleSided 是一种材质的属性,让一种材质在表面的两侧渲染,但是你不能对一种材质做任何事情来转动它分成两个.

That implies a plane has only one material — isDoubleSided is a property of a material, letting that one material render on both sides of a surface, but there's nothing you can do to one material to turn it into two.

如果你想要一个有两种材料的平面,你可以按照文档的建议将两个平面背靠背排列.使它们都是包含节点的子节点,然后您可以使用它来将它们移动到一起.或者您可以制作一个在一维上非常薄的 SCNBox.

If you want a flat surface with two materials, you can arrange two planes back to back as the doc suggests. Make them both children of a containing node and you can then use that to move them together. Or you could perhaps make an SCNBox that's very thin in one dimension.

这篇关于如何使用 2 种不同材料为 scnplane 着色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆