Hi there.
Thanks to amazing help from you guys, I've managed to code a 360 image carousel, where the user can browse 360 images located inside the project package.
Is there a way to access the filesystem on AVP outside the app?
I know about the FileManager, and I can get access to the .documentsDirectory, but how do I access documents folder from the "Files" app on the AVP?
My goal is to read images from a hardcoded folderlocation on the AVP, such that the user never will have to select the images themselves.
I know this may not be the "right" way to do this. The app is supposed to be "foolproof" with a minimum of userinteraction.
The only way to change the images should be to change the contents of the hardcoded imagefolder.
I hope this makes sense =)
Thanks in advance!
Regards,
Kim
Post
Replies
Boosts
Views
Activity
Hi there!
I´m trying to make a 360 image carousel in RealityView/SwiftUI with very large textures. I´ve managed to load one 12K 360 image and showing it on a inverted sphere with a ShaderMaterialGraph made in Reality Composer Pro. When I try to load the next image I get an out of memory error. The carousel works fine with smaller textures.
My question is. How do I release the memory from the current texture before loading the next?
In theory the garbagecollector should erase it eventually?
Hope someone can help =)
Thanks in advance!
Best regards,
Kim
Hi
I try to make a 360 stereo viewer, and I have made a ShaderGraphMaterial on Reality Composer Pro.
Im trying to use that material on a inverted sphere whitch is generated in Swift.
When I try to attach the material I get this error "Type of expression is ambiguous without a type annotation"
Here is the code (sorry im noob =) ):
import SwiftUI
import RealityKit
import RealityKitContent
import PhotosUI
struct ImmersiveView: View {
@Environment(AppModel.self) var appModel
var body: some View {
RealityView { content in
// Add the initial RealityKit content
guard let skyBoxEntity = await createSkybox() else {
return
}
content.add(skyBoxEntity)
}
}
}
private func createSkybox () async -> Entity? {
var matX = try? await ShaderGraphMaterial(named:
"/Root/Mat_Stereo360",
from: "360Stereo.usda",
in: realityKitContentBundle)
let sphere = await MeshResource.generateSphere(radius:1000)
let entity = await Entity()
entity.components.set(ModelComponent(mesh: sphere, materials:
[matX])). //ERROR HERE:
Type of expression is ambiguous without a type annotation
//entity.scale *= .init(x:-1, y:1, z:1)
return entity
}
I hope someone can help me =)
Best regards,
Kim