RealityKit MeshResource generated from SwiftUI shape

On Scenekit, using SCNShapewe can create SCN geometry from SwiftUI 2D shapes/beziers:https://developer.apple.com/documentation/scenekit/scnshape

Is there an equivalent in RealityKit?

Could we use the generate(from:) for that?https://developer.apple.com/documentation/realitykit/meshresource/3768520-generate https://developer.apple.com/documentation/realitykit/meshresource/3768520-generate

There's no direct API within RealityKit to do that today.

There is API to generate procedural meshes though - released last year with WWDC 21 and the RealityKit updates, although they lack any documentation on Apple's site. There's some documentation for it embedded within the Swift generated headers though, and Maxx Fraser wrote a decent blog post about how to use MeshDescriptors, which are at the core of the API. (https://maxxfrazer.medium.com/getting-started-with-realitykit-procedural-geometries-5dd9eca659ef). He also has some public swift projects that build geometry that makes a good example of how to use those APIs: https://github.com/maxxfrazer/RealityGeometries

I've been poking at the same space myself, generating meshes for Lindenmayer systems output - but I don't have anything to the extent of rendering 2D shapes into geometry using lathing or extrusion. The closest library to that I've seen available is Nick Lockwood's Euclid, but it only targets SceneKit currently.

Hello! New this year, we've introduced MeshResource(extruding: Path) which is an equivalent API to the one you mentioned in SceneKit.

Check out the API documentation. Also, check out the talk Build a spatial drawing app with RealityKit -- the splash screen of the app uses MeshResource(extruding:) to generate the app's logomark.

RealityKit MeshResource generated from SwiftUI shape
 
 
Q