x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Making a cylindrical mask instead of sphere

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?

Product Version: Not Selected
Tags:
more ▼

asked Apr 26 '15 at 03:59 PM in Rendering

avatar image

VoidGoat
162 24 29 34

avatar image ShayanMoradkhani Apr 24 '19 at 11:05 AM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

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.

Distance Field link

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.

more ▼

answered Apr 27 '15 at 06:01 PM

avatar image

RyanB STAFF
2.1k 56 24 118

avatar image VoidGoat Apr 28 '15 at 03:52 AM

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

avatar image RyanB STAFF May 19 '15 at 01:11 AM

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.

alt text

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:

alt text

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

avatar image RyanB STAFF May 19 '15 at 03:53 PM

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.

avatar image Hyperion 5 Mar 18 '17 at 11:58 PM

Thanks bro

avatar image manuaganu Jan 09 '16 at 09:45 AM

Hi...I really want to make this material...

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

If anyone is interested, here is a cone: alt text

снимок.png (235.6 kB)
more ▼

answered Mar 19 '17 at 04:50 PM

avatar image

Hyperion 5
6 4 3

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question