Sphere Mask - Creating A Belching Chimney
A mask value is produced by the sphere mask expression, and it is determined by a calculation of distance.
The mask value is 0 outside and 1 inside with some transition area in between if one of the inputs is the position of a point and the other input is the center of a sphere with some radius.
This is valid for component vectors with one, two, three, and four elements.
According to jesshiderue4, he was seeking a way to make a chimney that 'belched' out puffs of smoke, and dragging a sphere mask up the model seemed like one approach to accomplish this goal.
COPYRIGHT_HOOK: Published on https://thehooksite.com/sphere-mask/ by Kane Perkins on 2022-06-14T03:04:46.426Z
The Material is composed of two primary components:
- The first causes the chimney to grow along the X and Y axes
- While the second of which brings this motion upward along the Z-axis.
Utilizing a sine wave allows him to control how far in and out the Chimney moves.
After multiplying Time by 0.2, which slowed down the movement, he then multiplied the sine wave by 20, which made the expansion far larger. He gets rid of any negative values by taking this thing's absolute value (Abs) (which will stop my mesh from shrinking to smaller than its original size).
After that, he multiplies the VertexNormalWS by the modified Sine wave, and then he masks out the B channel, which corresponds to the Z-direction so that the chimney only expands in the horizontal direction.
After that, he appends the vector, setting the Z direction to zero, so that he ends up with a three-dimensional vector.
Note - As stated in the Material, do not remove the Z-movement until after the Sine wave and Vertex Normals have been multiplied together.
This is the only time that this may be done. If it is done before, the material will twist into an egg form rather than grow horizontally in an even manner.
In the second phase, he masked out the horizontal growth by using a sphere mask that he moved about.
He found Eric's explanation of a sphere mask to be quite helpful in comprehending how a sphere mask functions, and consequently how one may operate one.
The sphere mask creates a sphere that is centered on the actor's position by basically taking into account both the position of the Absolute World Position and the actor's position.
In order to raise the level of the sphere, then he first adjusts the Actor Position along the Z-axis by one.
He divides Time by 0.8 to have it move at a more leisurely pace, and then he takes the Frac.
The way that Frac works is by deleting the integer component of the number, leaving me with a value that loops and increments between 0.01 and 0.99 (with two decimal places).
After performing this operation (which makes the value visible in my world space), he appends it to the Z-part of a vector and then multiplies it by 400.
After making this adjustment to the Actor Position, he feeds the new value into the SphereMask.
The result of the SphereMask is plugged into Lerp's Alpha input, while the VertexNormalWS input is used for Lerp's A input, and the Appended vector input is used for Lerp's B input.
The final step involves connecting the output of the Lerp to the World Position Offset.
- Right-click on your project and select Create > Shader > PBR Graph.
- Name the new Shader “SampleGraph.”
- Double-click the Shader you created to open it.
- In the new window that opens, right-click and select Create Node.
- Type in “Color” and click the result that matches.
Choose the two pictures you want to mask, and then organize them into two distinct layers. Click the "Add layer mask" button at the bottom of the Layers panel once you have chosen a layer to mask in the Layers panel. On the layer that was selected, a white layer mask thumbnail will emerge, displaying everything that was on the layer that was selected.
- Provides the radius that will be utilized for calculating the distance.
- Identifies the dimensions of the transition area. This operates similarly to the brush hardness value in Photoshop. 0 indicates that the transition is challenging, while 100 indicates that the transition area is at its greatest (soft).
- A - The value that represents the position of the point to check is taken as an input here.
- B - This function takes the value that represents the center of the sphere as its input.
Sphere mask has a wide variety of applications. For example, in this scenario, it is used to scale a mesh along the Z-axis, to scale the mesh along all axes, and as an opacity mask.
Have you ever used a sphere mask? Do let us know in the comment section below.
Have you heard about real life Shrek?