我想在 SceneKit 中制作玻璃效果。 我在谷歌搜索但没有完美的答案。 所以我正在寻找可以清楚地解决我的问题的 SceneKit 战士。 我要制作一张图片。
它应该看起来像真的。 玻璃效果、反射和阴影是这里的重点。 我已经有 obj 和 dae 文件了。
那么,有没有人可以帮助我?
最佳答案
创建一个 SCNMaterial
并配置以下属性并将其分配给 SCNNode
的瓶子几何形状:
.lightingModel = .blinn
.transparent.content = // an image/texture whose alpha channel defines
// the area of partial transparency (the glass)
// and the opaque part (the label).
.transparencyMode = .dualLayer
.fresnelExponent = 1.5
.isDoubleSide = true
.specular.contents = UIColor(white: 0.6, alpha: 1.0)
.diffuse.contents = // texture image including the label (rest can be gray)
.shininess = // somewhere between 25 and 100
.reflective.contents = // glass won’t look good unless it has something
// to reflect, so also configure this as well.
// To at least a gray color with value 0.7
// but preferably an image.
根据场景中的其他内容、背景和使用的照明,您可能必须调整上述值以获得所需的结果。如果您想要一个没有标签的瓶子,请使用 .transparency 属性(将其内容设置为灰色)而不是 .transparent 属性。
关于ios - SceneKit Material 中的玻璃效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46721259/