How to rotate output of Box Mask 3D Node?

I have a material with BoxMask-3D node setup like below to create a mask

However, I cant figure out how to rotate the mask :confused:. This is what I want to achieve

How do I go about creating the above effect?

1 Like

Bump, did you find anything?

The trick here is to rotate the worldposition before plugging it in.

You want to rotate worldposition using the pivot or B input on the boxmask as the pivot point for your rotateaboutaxis node. normalized axis can simply be 0,0,1 to rotate around world Z.

Also remember that when using the “rotate about axis” node that it is intended for worldposition offset, so if you use it in a non-WPO case, you need to add the result back to the original “position” which would be worldposition in your case.

also keep in mind that rotation angle is 0-1 mapped to 0-360, so 0.25 corresponds to a 90 degree rotation. No idea why we went with that normalized value, bugs me every time :wink: good luck.

1 Like

Thanks for asking this. That’s what I wanted to achieve too, without succes.
And Ryan: thanks for the trick!

I had tried the rotateaboutaxis node before but I had gotten a weird result. Didn’t know that I had to add the result back to the original position :stuck_out_tongue:

Thanks alot! :smiley:

Final Working Setup


5 Likes

Thanks for this! I managed to create a way to rotate hit masks on projected UVs on Render Targets. The original sample code from the GDC talk draws spheres, I changed to draw rotated rectangles.

Blueprint (adapted from the ShaderBits GDC Pack below): Rotate Render Target project UV Box Hit Mask posted by anonymous | blueprintUE | PasteBin For Unreal Engine

Resources used for those interested:

2 Likes