Need help parsing planar data & AbsoluteWorldPosition in Material Editor
In my project, I'm trying to design a material that will only display when viewed through a particular window frame (almost like a portal effect). To do this, I am dynamically calculating a custom view frustum based off of the player's camera position and empty actors placed at the corners of the window frame to define the edges. I want to use opacity masking to set the material up so that, at each pixel, if it is within the bounds I have set (on the correct side of each of the four planes), then it will draw; if not, it will be masked.
Please note that, due to technical limitations in the project, I cannot use Render Textures or any Post Processing effect (like Custom Render Depth) to achieve similar results.
I am calculating the planes in the level blueprint like so:
Then, I am passing that information to the material using a global Material Parameter Collection, and setting up the opacity mask like this:
However, the material is not behaving correctly, and is giving me anomalous results that I can't quite understand. I've tried splitting up the planes individually to observe their behavior, and each seems to be failing in a different, inconsistent manner. Using various debugging tests, I can confirm that the planes are calculating correctly for exactly what I want, so I know that my math checks out (the result of the dot product should be positive if it's on the side of the plane that I want, and negative if it's on the other side). I'm starting to suspect that the data somehow isn't getting parsed properly when it gets passed to the material, but I'm frankly not familiar enough with the Material Editor to understand what's happening.
Can anyone help me understand how to make this work properly, or spot anything I'm missing? Any help you can provide would be greatly appreciated. Thanks!
asked Jan 26 '17 at 04:26 PM in Blueprint Scripting
I finally found the answer. In case anyone else needs this in the future, here is the solution:
answered Jan 27 '17 at 08:41 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here