Creating a cutting plane effect creates a spherical cutting plane.

I made a cutting plane effect using a material in UE4. However, when I move the plane around it cuts in a slight spherical shape, not a perfect plane like I want it to.

http://puu.sh/pFrey/a9f096ebe2.jpg

The selected white device on the right dictates the orientation of the plane. I used the up vector as the plane definition.

http://puu.sh/pFrl3/3385ad9668.png

I keep the position and up vector of the plane using a MaterialParameterCollection.

http://puu.sh/pFrrv/4891525da1.png

I calculate the vector between the position of the fragment and the position of the plane, and dot that vector with the up vector. Both are normalized so I can use the cosine value to find out on which side of the plane the fragment is and thus mask it away if it is on the do-not-render-side.

However, the cutting plane bends as you can see in the first image. I have no idea why.

The second problem is that I want to be able to select an actor and use the cutting plane on that actor only; essentially turning the effect on and off on any material. For example, I have a hologram material and a cloth material. I want this masking effect to apply to the result of the underlying material. I tried making it a material function and override the mask or do it the other way around, but no mixing and meddling made it work. I either had to not get the cutting effect on the hologram or I didn’t get the transparent effect.

Is there a way to make it easy to apply the cutting plane to any material as described above?

[The only other question regarding something similar.][4]

Thank you for your help.

The answer was that my assumption that anything greater than zero would be treated as non-zero like booleans are in C++. However, this is wrong. Once I changed the material to return a zero OR a one using an IF module it works flawlessly. Change the clamp above for the if module.

Do you have a screenshot by chance. Slightly confused on your solution.
EDIT: This seems to work

103374-capture.png

The mask treats everything below 1 as 0, so you have to use the an if statement to return 0 when below or equal to zero and 1 when above. Like your solution there.