PortalComponent – allow world content to peek out

Hello,

I've been tinkering with PortalComponent on visionOS a bit but noticed that the content of the WorldComponent is always clipped to the mesh geometry of whatever entities have the PortalComponent applied. Now I'm wondering if there is any way or trick to allow contents of the portal to peek out – similar to the Encounter Dinosaurs experience on Vision Pro (I assume it also uses PortalComponent?). I saw that PortalComponent has a clippingPlane property (https://developer.apple.com/documentation/realitykit/portalcomponent/clippingplane-swift.property). But so far I haven't been able to achieve a perceptible visual difference with it.

If possible I would like to avoid hacky tricks using duplicate meshes or similar to achieve this. Thanks for any hints!

Hello,

to achieve this effect, you need two copies of the mesh (for example of the dinosaur): one inside of the portal and one outside. However, you might see the following:

  • if you use PBR materials, the lighting of the mesh outside the portal will be different from the lighting inside the portal, and you might notice a seam. That's why you might want to use unlit materials.
  • the mesh outside of the portal won't be clipped by default, and might appear behind the portal. You can solve that by using a ShaderGraphMaterial and discarding all the fragments that are behind the portal.

The clipping property is meant for the content inside the portal, and doesn't allow objects to come out of the portal.

If you want an easier way to implement this effect, feel free to file a feature request on http://feedbackassistant.apple.com and please share the FB ID here!

Hi, thanks so much for the quick reply! I was afraid that would be the case, seems kinda wasteful with the mesh copy :/ Will definitely file an enhancement request!

I got it working now: https://streamable.com/7nakkb But instead of using the ShaderGraphMaterial I put a plane behind the portal with an occlusion material. AFAIK ShaderGraphMaterial does not allow me to discard fragments though, correct?

And I should probably be able to still use PBR materials instead of Unlit if I give both models the same ImageBasedLightReceiverComponent?

Regarding ClippingPlane I'm curious: what would be a sample use case for the clipping inside of the portal world?

Feedback filed: FB13659588 Thank you!

@Graphics and Games Engineer

Are the comments you replied to definitely feasible? Are there any uncertainties?

the mesh outside of the portal won't be clipped by default, and might appear behind the portal. You can solve that by using a ShaderGraphMaterial and discarding all the fragments that are behind the portal.

How can the above be achieved?

I have created a simple demo, but I switch models when a certain amount of movement is reached. However, this is not a smart approach.

https://twitter.com/tokufxug/status/1763029777655771489

Also, if you move the same model inside and outside of the portal, the movement range will be different inside and outside of the portal, and you will see overlapping models. Anyway, I would appreciate it if you could provide a procedure or a sample program or a sample development project that shows how to do this.

Feedback was also provided.

https://feedbackassistant.apple.com/feedback/13665468

Portals have been enhanced this year with the ability to cross portal boundaries. It's discussed around the 20 minute mark, "Portal Enhancements" in the following video: https://developer.apple.com/videos/play/wwdc2024/10103/

PortalComponent – allow world content to peek out
 
 
Q