MDLMaterial无法正确呈现相对纹理图像

时间:2015-11-25 13:54:55

标签: ios textures scenekit modelio

我可以将纹理图像加载并查看到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)

我是否需要其他设置来正确渲染图像?

1 个答案:

答案 0 :(得分:0)

并非Scene Kit中提供了Model I / O可以表示的所有内容。例如,基于物理的渲染是不受支持的功能之一。

相关问题