Trying to rotate a box mask

Hi,

I’m currently trying to create a shader that partially occludes a mesh by using a box mask.

The box mask is driven by the scale, location and rotation of another blueprint.

I divide the rotation by 360 to get the rotation angle, before using three different ‘RotateAboutAxis’ nodes to rotate the box mask.

This works fine if i rotate the blueprint in one axis, however as soon as i try to use multiple rotations, it doesn’t give accurate results.

Any help would be appreciated!

Did you ever figure this out? I am having the exact same issue, it kinda works but not really.

It can be done by chaining rotations together, but math for figuring out is a bit more involved.
Instead you should transform absolute world position to a mask space, which you would need to define with 3 basis vectors and origin. The math for transforming a point from one coordinate space to another coordinate space are easily found on the web.

https://forums.unrealengine.com/development-discussion/rendering/97595-boxmask-3d-rotation-question

try my solution here

https://forums.unrealengine.com/development-discussion/rendering/97595-boxmask-3d-rotation-question

hope this helps someone!

You’re a legend mate. I spent ~5 days playing with how to get a cube to draw on a plane-- went into quaternions and linear algebra all because I didn’t think to apply the position from the previous rotation into the next one. I noticed that I only had to negate the z axis in mine