Session 10166 goes into wonderful detail about the construction of spatial photos, and the various parameters that define the relationship between left and right images. The session provides everything I need to know to combine a left and right frame, and create a spatial image output.
But I'd like to do a live preview on the Vision Pro. Change the baseline and see what it looks like. See the horizontal disparity/convergence adjustment and move the image back and forth.
Cropping, and vertical alignment, would be easy to implement live. Horizontal disparity, and baseline length? I'm baffled.
How would I create a Shader Graph to let me make these adjustments using sliders or similar affordances, and pipe the results to a Camera Index Switch? I already have a working stereography app, but the stereo parameters are not interactive at all.
I could regenerate the spatial image after each change and refresh the display, but that is awfully clunky. What's a better way?
Post
Replies
Boosts
Views
Activity
In my visionOS app, I have an initial WindowGroup (no parameters), which opens correctly on application launch. I have multiple other WindowGroup(for:) closures in the app, too.
If I open one of the other WindowGroup(for:) windows, then close the initial window, I can't get the initial window back. If I close the second window, then tap on app icon, the second window reappears, but the initial window isn't shown.
The only way to get the initial window back, once it's closed, is to force-quit the app and restart.
A one-file reproducible example is below. In this example, the "button tapped" window is the second window. What do I need to do to get the initial window back?
Note this problem is in a visionOS app. But I've been able to reproduce even if I remove the RealityKitContent package from the target.
If I close, say, Safari's only window, then Safari exits, and shows me its window when I relaunch. The behavior I'd like to see is that when I "click" the app icon, the app presents its main window again.
I have also tried giving the WindowGroup an id. That does allow me to openWindow from another window (could use a toolbar item for that), but it doesn't get the main window to appear on launch, and I end up with multiple copies of the Main window.
import SwiftUI
@main
struct Limbo_MREApp: App {
var body: some Scene {
// I've also tried this form, same result
// WindowGroup(id: "main") {
WindowGroup {
ContentView()
}
WindowGroup(for: String.self) { $string in
if let string {
Text(string)
.font(.extraLargeTitle2)
}
}
}
}
struct ContentView: View {
@Environment(\.openWindow) var openWindow
var body: some View {
VStack {
Text("Hello, world!")
Button("Tap Me", systemImage: "doc.on.doc") {
openWindow(value: "button tapped")
}
}
}
}