Download

Ray traced sphere questions and portal woes.

I’m using a raytracedsphere node in a material to to mask out and slowly reveal the inside of a box that is otherwise invisible. So in the room the player is standing they see a 2d sphere centered on a world location through wich all objects with the material are visible.

mat1.jpg

and the result looks like this:
76e0eb3b5641b57857aef77f189e0b03f33f3dcd.jpeg

Now if a player get’s inside the box the sphere suddenly exists on two locations. The original world position I fed it and what appears to be directly opposite the traced rays.
It looks like this:
shop2.jpg
This screenshot is taken from the location marked in the second image in this post. The camera is outside the sphere radius and inside the box.

Is there some way to prevent this from happening?
I tried using a sphere gradient 3d instead of a ray traced sphere but that only looks good from a distance.

Is there some way I can use a different shape instead of a sphere to do this ray trace mask thing? maybe squeeze it along a vector to get an oval somehow? or have it use a 3d object in the world maybe?

What Im trying to do is to create a one time use portal effect in VR. Portal appears, player sees magical place, steps through and is trapped followed by shenanigans to escape.
A static interior cube map is to obviously a cube and doesn’t feel like a gateway when stepping through it.
A scenecapturecube whose movement is tied to the hmd works really well but costs way to much performance.
A 2d scenecapture based material I think needs screenaligneduv’s, but there’s two screens in VR and the screenposition trick to send different images to the different screens does not work when using instanced stereo.

Any and all assistance is greatly apreciated :slight_smile:

I’m still stuck at this.
Anyone have any ideas that could work?
Or perhaps a work around for sending different textures to different screens of the headset when using instanced stereo.

I just spent all day trying out variations of 2d scenecapture. I’d also love for an alternative or insight into a way to get this effect.

I think it is possible with planar reflection. It returns accurate mirror-like render.
But planar reflection node doesn’t have render target input, so you can’t apply it to some portal material.

So, it looks like it is possible to achieve with custom scene capture actor, which uses planar reflection projection algorithm (it should be implemented in PlanarReflectionShaders.usf), and renders it to specific render target which can be used in portal material.

But I’m also want to hear better advises :slight_smile:

The second sphere you see is related to this thread i show how you can remove the unexpected one. If you want to achieve slow transition as you go through the sphere you should use the output 0-1 sphere density