Creating a 3d Triangular Prism for masking

I want to create a triangular prism masking shape in a similar way to a BoxMask-3D. I am using the formula for a triangular prism from Inigo Quilez :: fractals, computer graphics, mathematics, shaders, demoscene and more and I have it set up in my material like this:

I am able to get the BoxMask3d to work just fine but I cannot seem to get this triangular prism shape to work. Any suggestions?

hey there!
i think that you re just missin the position here. on this SDF function , the shapes are located at the origin of the world, you may need to substract the position where you want your shape from the world coordinate.

Thank you @expose this worked.

Hi , is there a chance you could share your prism shape? I’m doing something similar at the moment and got stuck with getting formulae you mentioned in your original post into Unreal Engine.
Thanks a lot in advance.

Do you mean the formula? I translated the “Triangular Prism -Bound” equation from Inigo Quilez :: fractals, computer graphics, mathematics, shaders, demoscene and more into the material as you can see above. Which shape are you trying to do?

Just to give an account of how I handled this: I needed the triangular prism shape to make certain sections of my walls “dither”. After applying the fix suggested by @expose, I got this result:

In addition to changing the location of the shape from the origin, I also had to do some rotation. Here is the final material logic. I will include the material functions I used as well.

This Material takes in a Rotation and a LocOffset. This is done in my Wall blueprint via a few Set Vector Parameter values for my material instance Dynamic.

This is the rotation portion.
The next part is pretty much the same as the picture I attached in the OP. The only difference is how I set the location of the shape (the start of the logic):

Ok, thanks, I got it. So you manually translated this formula into material without using custom node, didn’t you? I’m trying to make a dynamic pie chart taking standard cylinder shape as a base and masking parts of it with triangular prism.