2022 EssentialsSpatial Computing
WWDC22 · 19 min · Essentials / Spatial Computing
Discover ARKit 6
Discover how you can build more refined and powerful augmented reality apps with ARKit 6. We’ll explore how you can create AR experiences rendered in 4K HDR and take you through camera settings customizations for your app. We’ll also share how you can export high-resolution still images from an ARKit session, take advantage of Plane Estimation and Motion Capture, and add AR Location Anchors in new regions.
Watch at developer.apple.com ↗Code shown on screen · 5 snippets
HighRes Capturing
if let hiResCaptureVideoFormat = ARWorldTrackingConfiguration.recommendedVideoFormatForHighResolutionFrameCapturing {
// Assign the video format that supports hi-res capturing.
config.videoFormat = hiResCaptureVideoFormat
}
// Run the session.
session.run(config) highRes background photos
session.captureHighResolutionFrame { (frame, error) in
if let frame = frame {
saveHiResImage(frame.capturedImage)
}
} HDR support
if (config.videoFormat.isVideoHDRSupported) {
config.videoHDRAllowed = true
}
session.run(config) AVCapture Session
if let device = ARWorldTrackingConfiguration.configurableCaptureDeviceForPrimaryCamera {
do {
try device.lockForConfiguration()
// configure AVCaptureDevice settings
…
device.unlockForConfiguration()
} catch {
// error handling
…
}
} plane anchors
// Create a model entity sized to the plane's extent.
let planeEntity = ModelEntity(
mesh: .generatePlane (
width: planeExtent.width,
depth: planeExtent.height),
materials: [material])
// Orient the entity.
planeEntity.transform = Transform(
pitch: 0,
yaw: planeExtent.rotationOnYAxis,
roll: 0)
// Center the entity on the plane.
planeEntity.transform.translation = planeAnchor.center Resources
Related sessions
-
26 min -
13 min -
1 min -
20 min