【问题标题】:MDLMaterial does not correctly render relative texture imageMDLMaterial 无法正确渲染相对纹理图像
【发布时间】:2015-11-25 13:54:54
【问题描述】:

我可以在SCNMaterial 中加载和查看纹理图像。如果我尝试使用相同的图像将SCNMaterial 替换为MDLMaterial,则无法正确渲染纹理:

let scattering:MDLPhysicallyPlausibleScatteringFunction = MDLPhysicallyPlausibleScatteringFunction()
scattering.baseColor.textureSamplerValue = MDLTextureSampler()
scattering.baseColor.textureSamplerValue?.texture = MDLTexture(named: "art.scnassets/metal_bumpy_squares_Base_Color.png")

let mdlMaterial = MDLMaterial(name: "cube", scatteringFunction: scattering)
let node = SCNNode(geometry: SCNSphere(radius: 1))
node.geometry?.firstMaterial = SCNMaterial(MDLMaterial: mdlMaterial)
// With SCNMaterial works as expected
// node.geometry?.firstMaterial = SCNMaterial()
// node.geometry?.firstMaterial?.diffuse.contents = "art.scnassets/metal_bumpy_squares_Base_Color.png"
// node.position = SCNVector3Make(0,0,-3)

是否需要其他设置才能正确渲染图像?

【问题讨论】:

    标签: ios textures scenekit modelio


    【解决方案1】:

    并非模型 I/O 可以表示的所有内容都在 SceneKit 中可用。例如,基于物理的渲染是不受支持的功能之一。

    【讨论】:

    • 从 iOS 10 开始,SceneKit 现在支持基于物理的渲染,我相信它与 Model I/O 的 PBR 表示配合得很好。
    猜你喜欢
    • 1970-01-01
    • 2022-01-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-06
    • 2023-04-11
    • 1970-01-01
    相关资源
    最近更新 更多