Explore advanced rendering with RealityKit 2

RSS for tag

Discuss the WWDC21 session Explore advanced rendering with RealityKit 2.

Posts under wwdc21-10075 tag

6 Posts

Post

Replies

Boosts

Views

Activity

Dynamic Mesh Updates
Dear all, In "Explore advanced rendering with RealityKit 2," Courtland presents how one can efficiently leverage dynamic meshes in RealityKit and update them at runtime. My question is quite practical: Say, I have a model of fixed topology and a set of animations (coordinates of each vertex per frame, finite duration) that I can only generate at runtime. How do I drive the mesh updates at 60FPS? Can I define a reusable Animation Resource for every animation once at startup and then schedule their playback like simple transform animations? Any helpful reply pointing me in the right direction is appreciated. Thank you. ~ Alexander
0
0
1.4k
May ’22
Pass animatable custom parameters to metal shader in RealityKit 2
Hi, In SceneKit I pass custom parameters to a metal shader using a SCNAnimation, for example: let revealAnimation = CABasicAnimation(keyPath: "revealage") revealAnimation.duration =  duration revealAnimation.toValue = toValue let scnRevealAnimation = SCNAnimation(caAnimation: revealAnimation) material.addAnimation(scnRevealAnimation, forKey: "Reveal") How would I do similar to a metal shader in RealityKit? I saw in the Octopus example: //int(params.uniforms().custom_parameter()[0]) But it's commented out and there is no example how to set the custom variable and animate it? (unless I missed it) Great session BTW Thanks
2
0
2.0k
Mar ’22
Pass cube map to metal shader in RealityKit 2
I would like to pass in a cube map to a custom material shader in RealityKit 2 so I can achieve effects like custom reflections and iridescence. I am aware of material.custom.texture and material.custom.value as talked about here: https://developer.apple.com/forums/thread/682632 But those only allow for a 2D texture and a                     simd_float4 (a vector of 4 float values). And I am aware of how to pass in animatable custom parameters as talked about here: https://developer.apple.com/forums/thread/682632 But I would like to be able to sample a cube map instead of a 2D texture. Any help is much appreciated.
1
0
1.3k
Sep ’21
Set camera feed as texture input for CustomMaterial
Hello, in this project https://developer.apple.com/documentation/arkit/content_anchors/tracking_and_visualizing_faces there is some sample code that describes how to map the camera feed to an object with SceneKit and a shader modifier. I would like know if there is an easy way to achieve the same thing with a CustomMaterial and RealityKit 2. Specifically I'm interested in what would be the best way to pass in the background of the RealityKit environment as a texture to the custom shader. In SceneKit this was really easy as one could just do the following: material.diffuse.contents = sceneView.scene.background.contents As the texture input for custom material requires a TextureResource I would probably need a way to create a CGImage from the background or camera feed on the fly. What I've tried so far is accessing the captured image from the camera feed and creating a CGImage from the pixel buffer like so: guard     let frame = arView.session.currentFrame,     let cameraFeedTexture = CGImage.create(pixelBuffer: frame.capturedImage),     let textureResource = try? TextureResource.generate(from: cameraFeedTexture, withName: "cameraFeedTexture", options: .init(semantic: .color)) else {     return } // assign texture customMaterial.custom.texture = .init(textureResource) extension CGImage {   public static func create(pixelBuffer: CVPixelBuffer) -> CGImage? {     var cgImage: CGImage?     VTCreateCGImageFromCVPixelBuffer(pixelBuffer, options: nil, imageOut: &cgImage)     return cgImage   } } This seems wasteful though and is also quite slow. Is there any other way to accomplish this efficiently or would I need to go the post processing route? In the sample code the displayTransform for the view is also being passed as a SCNMatrix4. CustomMaterial custom.value only accepts a SIMD4 though. Is there another way to pass in the matrix? Another idea I've had was to create a CustomMaterial from an OcclusionMaterial which already seems to contain information about the camera feed but so far had no luck with it. Thanks for the support!
8
0
4.1k
Aug ’21
Dynamic Mesh Updates
Dear all, In "Explore advanced rendering with RealityKit 2," Courtland presents how one can efficiently leverage dynamic meshes in RealityKit and update them at runtime. My question is quite practical: Say, I have a model of fixed topology and a set of animations (coordinates of each vertex per frame, finite duration) that I can only generate at runtime. How do I drive the mesh updates at 60FPS? Can I define a reusable Animation Resource for every animation once at startup and then schedule their playback like simple transform animations? Any helpful reply pointing me in the right direction is appreciated. Thank you. ~ Alexander
Replies
0
Boosts
0
Views
1.4k
Activity
May ’22
Pass animatable custom parameters to metal shader in RealityKit 2
Hi, In SceneKit I pass custom parameters to a metal shader using a SCNAnimation, for example: let revealAnimation = CABasicAnimation(keyPath: "revealage") revealAnimation.duration =  duration revealAnimation.toValue = toValue let scnRevealAnimation = SCNAnimation(caAnimation: revealAnimation) material.addAnimation(scnRevealAnimation, forKey: "Reveal") How would I do similar to a metal shader in RealityKit? I saw in the Octopus example: //int(params.uniforms().custom_parameter()[0]) But it's commented out and there is no example how to set the custom variable and animate it? (unless I missed it) Great session BTW Thanks
Replies
2
Boosts
0
Views
2.0k
Activity
Mar ’22
Building an Immersive Experience with RealityKit - POOR performance
hi In my M1 iPad Pro gets to 25 fps after 20 seconds and same for my iPhone pro 12 seems to happen when scenereeconstruction is on is this going to be improved? or should I just stick with SceneKit?
Replies
0
Boosts
0
Views
801
Activity
Sep ’21
Pass cube map to metal shader in RealityKit 2
I would like to pass in a cube map to a custom material shader in RealityKit 2 so I can achieve effects like custom reflections and iridescence. I am aware of material.custom.texture and material.custom.value as talked about here: https://developer.apple.com/forums/thread/682632 But those only allow for a 2D texture and a                     simd_float4 (a vector of 4 float values). And I am aware of how to pass in animatable custom parameters as talked about here: https://developer.apple.com/forums/thread/682632 But I would like to be able to sample a cube map instead of a 2D texture. Any help is much appreciated.
Replies
1
Boosts
0
Views
1.3k
Activity
Sep ’21
Set camera feed as texture input for CustomMaterial
Hello, in this project https://developer.apple.com/documentation/arkit/content_anchors/tracking_and_visualizing_faces there is some sample code that describes how to map the camera feed to an object with SceneKit and a shader modifier. I would like know if there is an easy way to achieve the same thing with a CustomMaterial and RealityKit 2. Specifically I'm interested in what would be the best way to pass in the background of the RealityKit environment as a texture to the custom shader. In SceneKit this was really easy as one could just do the following: material.diffuse.contents = sceneView.scene.background.contents As the texture input for custom material requires a TextureResource I would probably need a way to create a CGImage from the background or camera feed on the fly. What I've tried so far is accessing the captured image from the camera feed and creating a CGImage from the pixel buffer like so: guard     let frame = arView.session.currentFrame,     let cameraFeedTexture = CGImage.create(pixelBuffer: frame.capturedImage),     let textureResource = try? TextureResource.generate(from: cameraFeedTexture, withName: "cameraFeedTexture", options: .init(semantic: .color)) else {     return } // assign texture customMaterial.custom.texture = .init(textureResource) extension CGImage {   public static func create(pixelBuffer: CVPixelBuffer) -> CGImage? {     var cgImage: CGImage?     VTCreateCGImageFromCVPixelBuffer(pixelBuffer, options: nil, imageOut: &cgImage)     return cgImage   } } This seems wasteful though and is also quite slow. Is there any other way to accomplish this efficiently or would I need to go the post processing route? In the sample code the displayTransform for the view is also being passed as a SCNMatrix4. CustomMaterial custom.value only accepts a SIMD4 though. Is there another way to pass in the matrix? Another idea I've had was to create a CustomMaterial from an OcclusionMaterial which already seems to contain information about the camera feed but so far had no luck with it. Thanks for the support!
Replies
8
Boosts
0
Views
4.1k
Activity
Aug ’21
Can i use PhotogrammetrySession on linux
Can i use PhotogrammetrySession on the centos7
Replies
0
Boosts
0
Views
920
Activity
Aug ’21