Hi! I am using custom depth to prevent a portal from occluding an object. However, even with the correct setup of position and forward vector on both instances, the small one does not seem to work right. Any ideas?
The shader uses CylinderIntersection and TransformToZVector.
For my own basic experiments with portals, I originally just defined the two halves of the portal system as “Origin” and “Exit”, and they each generated their own set of shader parameters (with the parameters prefixed with Origin_ and Exit_). Then, rather than two material instances, there was just one material that took both sets of parameters.
This did have the downside that the system was limited to a single pair of portals at a time, but given the scenario I was prototyping it for, that limitation that didn’t cause huge problems. (It’s also worth noting that the names were arbitrary; you could travel from either portal to the other one.)
That said, given that what you’re doing and what I did might differ in various ways in implementation, I don’t know whether or not that’s a viable option for you.
I have tried hardcoding the values but it wasn’t the problem, it turns out that if you use an X axis aligned vector as the Z axis of CylinderIntersection you have to connect a correct X axis to the node. My bad!
Hello! Would you mind if I asked how you achieved this effect? I’ve tried to do it, but for some reason it won’t change the opacity of the object in a gradual change. It just snaps once you rotate the camera to 90 degrees of a portal to making the other half invisible. This makes it a mess and very choppy.