Post

Replies

Boosts

Views

Activity

Reply to How can i add a UIView on the material of the ModelEntity?
Hi, is your UIView static or does it change a lot? If it's just a static view you could create a snapshot, extract it's CGImage and convert that into a TextureResource (https://developer.apple.com/documentation/realitykit/textureresource/3768851-generate) that could be mapped on whatever model you want. In case it is animated I assume you could render that view with your desired update interval into a Metal Texture and then use the DrawableQueue API to update your material with the new texture: https://developer.apple.com/documentation/realitykit/textureresource/drawablequeue Maybe this GitHub sample I've done could help you with the latter option: https://github.com/arthurschiller/realitykit-drawable-queue
Topic: Graphics & Games SubTopic: RealityKit Tags:
Nov ’21
Reply to RealityKit AnimationEvents question
If I understood your question correctly something like this should work: var targetTransform = entityToAnimate.transform targetTransform.translation.x += 0.4 let animationPlaybackController = entityToAnimate.move(to: targetTransform, relativeTo: entityToAnimate.parent, duration: 3, timingFunction: .easeOut) arView.scene.subscribe(to: AnimationEvents.PlaybackCompleted.self, on: entityToAnimate) { [weak self] event in     if event.playbackController == animationPlaybackController {         print("Animation completed!")     } } .store(in: &subscriptions)
Topic: Graphics & Games SubTopic: RealityKit Tags:
Nov ’21
Reply to Transparent blending with gradient texture leads to color banding (RealityKit 2)
Alright, I'm an idiot. So apparently you need to explicitly set the blending property also on your CustomMaterial to make it work, which kinda makes sense but wasn't clear for me right away. So for example this: guard var customMaterial = try? CustomMaterial(…) else { return } customMaterial.blending = .transparent(opacity: .init(floatLiteral: 1)) // .transparent is important! – floatliteral can be whatever customMaterial.faceCulling = .none customMaterial.emissiveColor = .init(color: .red) works fine with proper blending of faces behind the object. Whereas if you don't specify the blending the default is .opaque and then if you would set the opacity in your fragment shader like so: surface.set_opacity(0); the CustomMaterial kinda works similar to an Occlusion Material from my testing and hides everything behind it. What I haven't found out yet is how I can disabling the color banding when setting a black and white gradient texture as the blending texture. Will investigate and maybe file feedback for that!
Topic: Graphics & Games SubTopic: RealityKit Tags:
Sep ’21
Reply to Transparent blending with gradient texture leads to color banding (RealityKit 2)
Thanks for the tip but unfortunately that does not make any difference. I've already tried a lot of variants. Should I create a sample project? I'm starting to think this issue might be exclusive to CustomMaterial. Based on these docs: https://developer.apple.com/metal/Metal-RealityKit-APIs.pdf […] If there are two entities, one in front of the other, for example, and the closer entity is translucent, both of those entity’s fragments contribute to the final color of that one pixel. I feel like this should work? Otherwise if I stay with the first variant, do you have any idea how I could get rid of the gradient banding?
Topic: Graphics & Games SubTopic: RealityKit Tags:
Sep ’21
Reply to RealityKit - How can I calculate distance between two anchorEntity?
For world space something like this should work: let distance = simd_distance(entityA.position(relativeTo: nil), entityB.position(relativeTo: nil))
Topic: Graphics & Games SubTopic: RealityKit Tags:
Replies
Boosts
Views
Activity
Feb ’22
Reply to Reality Converter - Unlit Material
I think you can drag and drop images into RealityComposer which are then essentially rendered like a plane with an Unlit Material, but afaik you can not set an Unlit Material for existing models explicitly via Reality Composer.
Replies
Boosts
Views
Activity
Nov ’21
Reply to How can i add a UIView on the material of the ModelEntity?
Hi, is your UIView static or does it change a lot? If it's just a static view you could create a snapshot, extract it's CGImage and convert that into a TextureResource (https://developer.apple.com/documentation/realitykit/textureresource/3768851-generate) that could be mapped on whatever model you want. In case it is animated I assume you could render that view with your desired update interval into a Metal Texture and then use the DrawableQueue API to update your material with the new texture: https://developer.apple.com/documentation/realitykit/textureresource/drawablequeue Maybe this GitHub sample I've done could help you with the latter option: https://github.com/arthurschiller/realitykit-drawable-queue
Topic: Graphics & Games SubTopic: RealityKit Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to RealityKit AnimationEvents question
If I understood your question correctly something like this should work: var targetTransform = entityToAnimate.transform targetTransform.translation.x += 0.4 let animationPlaybackController = entityToAnimate.move(to: targetTransform, relativeTo: entityToAnimate.parent, duration: 3, timingFunction: .easeOut) arView.scene.subscribe(to: AnimationEvents.PlaybackCompleted.self, on: entityToAnimate) { [weak self] event in     if event.playbackController == animationPlaybackController {         print("Animation completed!")     } } .store(in: &subscriptions)
Topic: Graphics & Games SubTopic: RealityKit Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to Loading of older .reality files is broken on iOS 15 (works on iOS 14)
If anyone from Apple is reading – I've created a radar with a sample project attached (FB9670736).
Topic: Graphics & Games SubTopic: RealityKit Tags:
Replies
Boosts
Views
Activity
Oct ’21
Reply to Transparent blending with gradient texture leads to color banding (RealityKit 2)
Alright, I'm an idiot. So apparently you need to explicitly set the blending property also on your CustomMaterial to make it work, which kinda makes sense but wasn't clear for me right away. So for example this: guard var customMaterial = try? CustomMaterial(…) else { return } customMaterial.blending = .transparent(opacity: .init(floatLiteral: 1)) // .transparent is important! – floatliteral can be whatever customMaterial.faceCulling = .none customMaterial.emissiveColor = .init(color: .red) works fine with proper blending of faces behind the object. Whereas if you don't specify the blending the default is .opaque and then if you would set the opacity in your fragment shader like so: surface.set_opacity(0); the CustomMaterial kinda works similar to an Occlusion Material from my testing and hides everything behind it. What I haven't found out yet is how I can disabling the color banding when setting a black and white gradient texture as the blending texture. Will investigate and maybe file feedback for that!
Topic: Graphics & Games SubTopic: RealityKit Tags:
Replies
Boosts
Views
Activity
Sep ’21
Reply to Transparent blending with gradient texture leads to color banding (RealityKit 2)
Thanks for the tip but unfortunately that does not make any difference. I've already tried a lot of variants. Should I create a sample project? I'm starting to think this issue might be exclusive to CustomMaterial. Based on these docs: https://developer.apple.com/metal/Metal-RealityKit-APIs.pdf […] If there are two entities, one in front of the other, for example, and the closer entity is translucent, both of those entity’s fragments contribute to the final color of that one pixel. I feel like this should work? Otherwise if I stay with the first variant, do you have any idea how I could get rid of the gradient banding?
Topic: Graphics & Games SubTopic: RealityKit Tags:
Replies
Boosts
Views
Activity
Sep ’21
Reply to flickering, double vision with raycast on iPadOS 15.0
Just as a general comment – I think instead of creating a new anchor on every frame explicitly there is also a reanchor method on AnchorEntity that you could use (set preservingWorldTransform to false).
Topic: Spatial Computing SubTopic: ARKit Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to Set camera feed as texture input for CustomMaterial
@CodeName I've just published a little sample project showing how to use DrawableQueue to implement transparent animated GIFs in RealityKit 2. Let me know if it's helpful. :) https://github.com/arthurschiller/realitykit-drawable-queue
Topic: Graphics & Games SubTopic: RealityKit Tags:
Replies
Boosts
Views
Activity
Aug ’21