【问题标题】:Glass effect in SceneKit materialSceneKit 材质中的玻璃效果
【发布时间】:2018-03-25 01:53:49
【问题描述】:

我想在 SceneKit 中制作玻璃效果。 我在谷歌搜索但没有完美的答案。 所以我正在寻找可以清楚地解决我的问题的 SceneKit 战士。 我要制作一张图片。

它应该看起来像真的。 玻璃效果、反射和阴影是这里的重点。 我已经有 obj 和 dae 文件了。

那么,有没有人可以帮助我?

【问题讨论】:

  • 查看 SceneKit 的基于物理的渲染 (PBR) 与环境照明。这应该是您正在寻找的东西。

标签: ios swift scenekit ios11 arkit


【解决方案1】:

创建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 属性。

【讨论】:

  • 感谢您的回答!你可以分享你制作的图像吗?还有一个问题。你能做出能透过玻璃看的影子吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2014-03-01
  • 1970-01-01
  • 2014-05-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多