Dunfey · Hotel WWDC as data, est. 1983
Front desk everything
Years
Topics

2021 Graphics & GamesSpatial Computing

WWDC21 · 28 min · Graphics & Games / Spatial Computing

Create 3D models with Object Capture

Object Capture provides a quick and easy way to create lifelike 3D models of real-world objects using just a few images. Learn how you can get started and bring your assets to life with Photogrammetry for macOS. And discover best practices with object selection and image capture to help you achieve the highest-quality results.

Watch at developer.apple.com ↗

Transcript all transcripts

Code shown on screen · 3 snippets

Creating a PhotogrammetrySession with a folder of images swift · at 6:56 ↗
import RealityKit

let inputFolderUrl = URL(fileURLWithPath: "/tmp/Sneakers/", isDirectory: true)
let session = try! PhotogrammetrySession(input: inputFolderUrl,
                                         configuration: PhotogrammetrySession.Configuration())
Creating the async message stream dispatcher swift · at 9:26 ↗
// Create an async message stream dispatcher task

Task {
    do {
        for try await output in session.outputs {
            switch output {
            case .requestProgress(let request, let fraction):
                print("Request progress: \(fraction)")
            case .requestComplete(let request, let result):
                if case .modelFile(let url) = result {
                    print("Request result output at \(url).")
                }
            case .requestError(let request, let error):
                print("Error: \(request) error=\(error)")
            case .processingComplete:
                print("Completed!")
                handleComplete()
            default:  // Or handle other messages...
                break
            }
        }
    } catch {
       print("Fatal session error! \(error)")
    }
}
Calling process on two models simultaneously swift · at 13:44 ↗
try! session.process(requests: [
    .modelFile("/tmp/Outputs/model-reduced.usdz", detail: .reduced),
    .modelFile("/tmp/Outputs/model-medium.usdz", detail: .medium)
])

Resources