I followed the instruction in this session and tried to write a demo with Object Capture API. But there's a MTLDebugRenderCommandEncoder assertion fails every time I call session.startDetecting(), just after the bounding box shows up.
The error shows:
-[MTLDebugRenderCommandEncoder validateCommonDrawErrors:]:5780: failed assertion `Draw Errors Validation
Fragment Function(fsRealityPbr): the offset into the buffer clippingConstants that is bound at buffer index 8 must be a multiple of 256 but was set to 128.
and my code is pretty simple:
var body: some View {
ZStack {
ObjectCaptureView(session: session)
if case .initializing = session.state {
Button {
session.start(imagesDirectory: getDocumentsDir().appendingPathComponent("Images/"), configuration: configuration) // 💥
} label: {
Text("Prepare")
}
} else if case .ready = session.state {
Button {
session.startDetecting()
} label: {
Text("Continue")
}
} else if case .detecting = session.state {
Button {
session.startCapturing()
} label: {
Text("Start Capture")
}
}
}
}
I'm wondering if anyone else is facing the same problem or if there's an error on my side?
Post not yet marked as solved
Hello, I am really excited about the new Object Capture API for iOS.
In the WWDC23 demo video, the user was rotating around the object. My question is does this API support taking photos from a fixed position (like on a tripod) and having a turntable to rotate the object?
Another question, if the user has already taken some photos with depth and gravity, can the Object Capture use these images to construct the 3D model instead of taking new ones?
Thank you.
After getting around some issues we finally got "something" to run.
But we have 2 issues now
getDocumentsDir() is not found on scope.
I guess this function was only shown on the video, but not really implemented globally, now looking through some "eskimo" code I found docDir implementation.
Which doesn't work either in this case.
Because session.start() never runs, all I have is a Black Screen with an animation saying "Move iPad to start".
QUESTION:
A) How can I force this to work?
I'm hoping to get capture the images to later process at a Mac.
So I don't think I need the "checkpoint" part of configuration.
Since getDocumentsDir() or docDir are not working,
B) is there anyway to just select whatever folder we can, maybe hardcode it?
Here is my code:
import Foundation
import RealityKit
import SwiftUI
// import Firebase
struct CaptureView: View {
let docDir = try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: true)
var body: some View {
ZStack {
// Make the entire background black.
Color.black.edgesIgnoringSafeArea(.all)
if #available(iOS 17.0, *) {
var session = ObjectCaptureSession()
var configuration = ObjectCaptureSession.Configuration()
// configuration.checkpointDirectory = getDocumentsDir().appendingPathComponent("Snapshots/")
// session.start(imagesDirectory: docDir.appendingPathComponent("Images/"), configuration: configuration)
ObjectCaptureView(session: session)
} else {
Text("Unsupported iOS 17 View")
}
}
.environment(\.colorScheme, .dark)
}
}
Post not yet marked as solved
I am trying ObjectCaptureSession in my Xcode 14.2 and i am getting error like "Cannot find 'ObjectCaptureSession' in scope". So my question is this object capture session is support in Xcode 14.2?
Hey!
I'm trying to add this line to my project:
var session = ObjectCaptureSession()
But it automatically says "Cannot find 'ObjectCaptureSession' in scope"
I cannot get this error to go away, so I haven't continued trying the snippets provided on your video.
Is there anything else I need to install or configure before this is ready?
I'm importing:
import RealityKit
import SwiftUI
import Firebase
In your video you mentioned that there is a sample code, but I can only find the snippets rather than a project. It's fine if there is no sample code, just that on the video you mentioned it, so it's confusing to not have the code, when it's mentioned so much on the video.
Xcode 15- Beta
iOS17 Sim installed
MacOS Ventura 13.3.1 a
Post not yet marked as solved
The sample application and code does not seem to be available in the WWDC app or in the documentation along with other Object Capture samples. Where/when will this be released?
Post not yet marked as solved
Object Capture for iOS can i send to the Robotic Operating System as Point Cloud