【问题标题】:How to set metalness as a float value when using PBRLightingModel in SceneKit?在 SceneKit 中使用 PBRLightingModel 时如何将金属度设置为浮点值?
【发布时间】:2017-05-28 14:16:54
【问题描述】:

在 Xcode 8 中,SceneKit 编辑器允许您在使用 SCNLightingModelPhysicallyBased 时为 metalness 属性设置浮点值。选项包括金属、电介质、浮点值或图像。选择 Metallic 将金属度设置为 1。选择 Dielectric 将其设置为 0。

metalness 设置为 1(在 SceneKit 编辑器 中允许)的编程等效项是什么? 金属度是只读属性。那么,将 someMaterial.metalness.contents 设置为 metalness 地图图像是我唯一的选择吗?

【问题讨论】:

  • OK - 将内容设置为 [UIColor blackColor] 有效。

标签: scenekit


【解决方案1】:

metalnessroughness 等一些材料属性接受 NSNumber 作为其contents

// Objective-C
material.roughness.contents = @0.5;
// Swift
material.roughness.contents = NSNumber(value: 0.5)

看起来在线文档还没有发现,但是SCNMaterialProperty 的标头文档包含此信息。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-02-06
    • 2017-03-21
    • 2015-09-05
    • 2010-12-22
    • 1970-01-01
    • 2022-01-08
    • 1970-01-01
    相关资源
    最近更新 更多