Monterey 12.6.4 broke metal sphereWithExtent and cylinderWithExtent

I think Monterey 12.6.4 produces deformed sphere and cylinder meshes.

Previous Monterey and last and latest Ventura do not have the issue.

Can you share your code please?

My code is based off: https://medium.com/@warrenm/thirty-days-of-metal-day-12-mdlmesh-and-mtkmesh-1a9f57400e2d

Running https://github.com/metal-by-example/thirty-days-of-metal/tree/master/12/MetalMTKMesh shows the error.

This is what they look like in 3D

It looks like your screenshot is from a different project, as Warren’s project doesn’t have a cylinder in it. Can you please share the exact code you are running to produce the scene you included a screenshot of?

I think I found the problem.

This works except on 12.6.4

    let mdlVertexDescriptor = MDLVertexDescriptor()
    mdlVertexDescriptor.vertexAttributes[0].name = MDLVertexAttributePosition
    mdlVertexDescriptor.vertexAttributes[0].format = .float3
    mdlVertexDescriptor.vertexAttributes[0].offset = 0
    mdlVertexDescriptor.vertexAttributes[0].bufferIndex = 0
    mdlVertexDescriptor.vertexAttributes[1].name = MDLVertexAttributeNormal
    mdlVertexDescriptor.vertexAttributes[1].format = .float3
    mdlVertexDescriptor.vertexAttributes[1].offset = 12
    mdlVertexDescriptor.vertexAttributes[1].bufferIndex = 0
    mdlVertexDescriptor.bufferLayouts[0].stride = 24
    vertexDescriptor = MTKMetalVertexDescriptorFromModelIO(mdlVertexDescriptor)!

This works everywhere

    let mdlVertexDescriptor = MDLVertexDescriptor()
    mdlVertexDescriptor.vertexAttributes[0].name = MDLVertexAttributePosition
    mdlVertexDescriptor.vertexAttributes[0].format = .float3
    mdlVertexDescriptor.vertexAttributes[0].offset = 0
    mdlVertexDescriptor.vertexAttributes[0].bufferIndex = 0
    mdlVertexDescriptor.vertexAttributes[1].name = MDLVertexAttributeNormal
    mdlVertexDescriptor.vertexAttributes[1].format = .float3
    mdlVertexDescriptor.vertexAttributes[1].offset = 16
    mdlVertexDescriptor.vertexAttributes[1].bufferIndex = 0
    mdlVertexDescriptor.bufferLayouts[0].stride = 32
    vertexDescriptor = MTKMetalVertexDescriptorFromModelIO(mdlVertexDescriptor)!

Seems related to: https://forums.kodeco.com/t/chapter-5-starter-project-stride-number-when-setting-normals/60781/8

Appears to be fixed in 12.6.8

Monterey 12.6.4 broke metal sphereWithExtent and cylinderWithExtent
 
 
Q