I’m working on a portal project, where I’m trying to add the illusion of depth but I’m having some trouble.
My portal has a circular ring and particles moving away (like a tunnel) with a capture component mask applied to them. I’d like to hide the particles individually based upon whether the player is looking at them through the ring or around the ring. I’m unable to get the math quite right.
In the picture below, the left segment of purple would be visible and the right segment would be invisible.
I have a function here put together from various math research intended to return the Z angle difference between two vectors. This inputs 3 vector locations: A) the particle WS, B) the center of the portal, and C) an edge (closest to camera of the two options). In the case of the diagram below, the edge can be the edge of the portal or the cameraWS. When matching against distance by checking with plain colors, the edge selection seems to work but something is wrong with the radian > degree conversion.
When I test this in the material editor, my outputs seem to be limited by range. If I have a center of 0,0,0, edge of 0,250,0, and the third vector as the camera, I get degrees of 180 - 6 based on my distance to 0,0,0
At distances > 200 from origin, the degrees return as .1111 and in the case of being within range I can’t get lower than 6.481 degrees.
My material blueprint: opacity by view angle posted by anonymous | blueprintUE | PasteBin For Unreal Engine 4
In theory, if the angles in my function return accurate values based on the camera angle, then I can set colors/opacirty based on whether or not they should be allowed. For some reason this isn’t returning the expected values.
Any help is appreciated.
**[Update to original method:] **
I recreated what I’m attempting to do via BP, you can see it here: https://www.youtube.com/watch?v=j81e…ature=youtu.be
What I can’t figure out is how to do this blueprintUE | PasteBin For Unreal Engine 4 via the material editor so that it can be done at the per-particle level.