I’ve been using a sphere mask to create location based opacity on my materials but what I really need is a cylindrical shape instead. is there a way to make a cylinder mask?

Hi VoidGoat,

what type of cylinder shape? As viewed from above a cylinder looks exactly like a circle (or sphere), and from the side a cylinder looks like a rectangle. From other angles a cylinder looks like an ellipse with a rectangle in the middle.

You could actually use the distance field shape for a cylinder if you want. That said there is probably a far easier method if you give some more info.

float sdCappedCylinder( vec3 p, vec2 h )

{

vec2 d = abs(vec2(length(p.xz),p.y)) - h;

return min(max(d.x,d.y),0.0) + length(max(d,0.0));

}

p would be worldposition. by first rotating or transform worldposition you could rotate the cylinder and scale it by scaling worldposition.

The shape you get from the cylinder would depend on how you sample it, ie offsetting from 0 would be like getting different cross sections in 2d.

I am making it appear as though there is a hole cut into the wall and it needs to be a cylindrical shape. right now the sphere mask is being used to make the area that the sphere touches transparent and i want this same effect but with a cylindrical shape instead

I made the cylinder distance field from above into a material network that you can copy. What this does is return a distance field for a the world. This is set up so that “height” also scales worldposition. To scale the cylinder, multiply worldposition by something first. To offset it, add something.

Here is that material applied to a few static mesh planes. You can see how each plane shows a cross section of where it intersections the cylinder function.

I was curious if you need to show the interior surface of the cylinder since that is quite a bit more work. You will have to do some research on detecting when the ray hits the caps vs the sides and then create virtual side coordinates. For those you could look at the “Spline Thicken” material function which does virtual cylinder exterior, making it an interior is just inverting the height variable.

And as you can see, cylinders look like circles from the side so there won’t be much to make this look different from a spheremask, yet this is still a cylinder hole by definition:

I am actually planning to mess with a ray-marching material function soon which would help in doing all this stuff.

hey, actually I got a raymarching distance field function working. The only downside is the custom node requires all the distance field functions be written inside of the function since custom nodes cannot communicate with eachother. It is also really expensive to use the normals. If you want this ill try to get it pasted here.

Hi…I really want to make this material…

How can we change Location,Height and Width of cylinder?

Thanks bro

does anyone know how to leave the opacity permanently? i understand it’s called location based opacity, which means where ever the actor is, the opacity location is updated. but is there any way to leave the effect behind as a trace as the actor is moving?

thanks in advance

Have you solved this problem? I’m also looking for cylindrical cameras and fisheye cameras;

If you solve it, can you share the method? Thank you very much. My email address is