Print view · Math · 57 pagesChoose "Save as PDF" as the destination in the print dialog.
Back to the docs

Mesh Morpher documentation

Math

57 pages · exported 2026-09-06 · https://meshmorpher.com/docs/studio-and-graph/voxel/math

Studio and Graph › Voxel

Math

Arithmetic, trigonometry, vector operations and comparisons evaluated per sample across the field.

Studio and Graph › Voxel › Math

Abs

Strips the sign, and it does two quite different jobs depending on what you feed it.

Abs node

The Abs node

When to use it

Strips the sign, and it does two quite different jobs depending on what you feed it.

On a coordinate you get free mirror symmetry. Abs of X makes everything symmetric about the YZ plane.

On a distance field you get a shell. The surface now sits wherever the field was plus or minus zero, so a solid ball turns into a hollow skin. Neither of those is obvious from the name.

Pins

Pin Type Description
Input Number The number to work on.
Pin Type Description
Result Number The answer.

Studio and Graph › Voxel › Math

Add

On a density field, adding a constant moves the whole surface in or out. That is how a noise field becomes solid ground: add enough and the surface swallows everything below it.

Add node

The Add node

When to use it

A plus B.

On a density field, adding a constant moves the whole surface in or out. That is how a noise field becomes solid ground: add enough and the surface swallows everything below it.

It is not a way to combine two shapes. Add two fields together and the result is neither of them. Union, Intersection and Subtraction are the nodes for that.

Pins

Pin Type Description
A Number The first number.
B Number The second number.
Pin Type Description
Result Number The answer.

Studio and Graph › Voxel › Math

Atan2

The angle of a 2D vector in radians, over the whole circle rather than half of it.

Atan2 node

The Atan2 node

When to use it

The angle of a 2D vector in radians, over the whole circle rather than half of it.

Pins

Pin Type Description
A Number The Y part of the direction.
B Number The X part of the direction.
Pin Type Description
Result Number The angle in radians, somewhere between -pi and pi.

Studio and Graph › Voxel › Math

Branch

Compares A and B with the operator you pick and forwards True or False accordingly. The comparison and the choice in one node.

Branch node

The Branch node

When to use it

Compares A and B with the operator you pick and forwards True or False accordingly. The comparison and the choice in one node.

Equal and NotEqual read the Tolerance pin, which defaults to 0.00001. That default is doing real work. Two values that came out of any arithmetic almost never land on the same float, so an Equal branch with Tolerance set to 0 takes the false arm over and over and reads as a broken wire.

When the result is a weight rather than a choice, Compare plus a multiply is cleaner. When the boundary should be soft, Select.

Pins

Pin Type Description
A Number The left side of the comparison.
B Number The right side of the comparison.
True Number Passed through when the comparison holds.
False Number Passed through when the comparison does not hold.
Tolerance Number Only matters for Equal and Not Equal. Two values closer together than this count as the same.
Comparison Choice Which test to run. Wire a Compare Op node in here to switch it from the graph.
Pin Type Description
Result Number Whichever of True and False the comparison picked.

Studio and Graph › Voxel › Math

Ceil

Rounds up to the nearest whole number. Floor's counterpart.

Ceil node

The Ceil node

When to use it

Rounds up to the nearest whole number. Floor's counterpart.

The pair gives you the two ends of the cell a value falls in, which is the basis of hand-built interpolation and most cell-index tricks.

Pins

Pin Type Description
Input Number The number to work on.
Pin Type Description
Result Number The answer.

Studio and Graph › Voxel › Math

Compare

Compares A against B and hands back 1 or 0. A mask you multiply with, not a branch.

Compare node

The Compare node

When to use it

Compares A against B and hands back 1 or 0. A mask you multiply with, not a branch.

When the answer is going to be multiplied anyway, this beats Branch and If. The graph stays flat and you avoid the hard edge a branch puts into the field.

The 0/1 edge is still an edge. Anywhere the transition will be visible as geometry, SmoothStep or a Select with a falloff looks better.

Pins

Pin Type Description
A Number The left side of the comparison.
B Number The right side of the comparison.
Tolerance Number Only matters for Equal and Not Equal. Two values closer together than this count as the same.
Comparison Choice Which test to run. Wire a Compare Op node in here to switch it from the graph.
Pin Type Description
Mask Number 1 when the comparison holds, 0 when it does not.

Studio and Graph › Voxel › Math

Cos

Cosine of the input, in radians.

Cos node

The Cos node

When to use it

Cosine of the input, in radians.

Pair it with Sin on the same angle for circles and spirals. On its own it is Sin shifted a quarter cycle, so picking the one whose value at zero you want, 1 for cos and 0 for sin, saves you an offset node.

Pins

Pin Type Description
Input Number The number to work on.
Pin Type Description
Result Number The answer.

Studio and Graph › Voxel › Math

Curve

Looks the input up on a Curve asset. The escape hatch for a response that would take five maths nodes to approximate and still not look right.

Curve node

The Curve node

When to use it

Looks the input up on a Curve asset. The escape hatch for a response that would take five maths nodes to approximate and still not look right.

Pins

Pin Type Description
Input Number The number to work on.
Pin Type Description
Result Number The answer.

Settings

Setting Type Description
Curve Asset Asset The curve to read. The incoming value picks the spot along the bottom of the curve; what comes out is the height there.

Studio and Graph › Voxel › Math

Distance To Line

Perpendicular distance to an infinite line.

Distance To Line node

The Distance To Line node

When to use it

Perpendicular distance to an infinite line.

Subtract a radius and you have an infinite cylinder along any axis, which is the cheapest way to get a tilted cylinder without rotating the domain.

Infinite is the catch. To cap it, intersect with two Planes, or use the Cylinder and Capsule primitives, which are finite to begin with.

Pins

Pin Type Description
LinePointX Number X of a point the line passes through.
LinePointY Number Y of a point the line passes through.
LinePointZ Number Z of a point the line passes through.
LineDirX Number X of the direction the line runs. All three together must come to length 1.
LineDirY Number Y of the direction the line runs.
LineDirZ Number Z of the direction the line runs.
Pin Type Description
Distance Number How far the voxel being sampled sits from the line, measured square to it. Never negative.

Studio and Graph › Voxel › Math

Distance To Plane

Signed distance to an infinite plane. Positive on the side the normal points, negative on the other.

Distance To Plane node

The Distance To Plane node

When to use it

Signed distance to an infinite plane. Positive on the side the normal points, negative on the other.

The sign is the whole point. It makes an above-or-below test and a half-space cutter the same node.

The Plane primitive is this packaged as a solid. This one hands you the number.

Pins

Pin Type Description
NormalX Number X of the direction the plane faces. Keep all three together at length 1.
NormalY Number Y of the direction the plane faces.
NormalZ Number Z of the direction the plane faces. Straight up by default.
Distance Number How far the plane sits along its own normal.
Pin Type Description
Result Number How far the voxel being sampled is from the plane. Positive on the side the normal points to, negative behind it.

Studio and Graph › Voxel › Math

Distance To Point

Straight-line distance from the sample point to a target point.

Distance To Point node

The Distance To Point node

When to use it

Straight-line distance from the sample point to a target point.

Subtract a radius and you have a sphere. Leave it raw and you have a radial falloff to drive something with.

When you want the shape, the Sphere primitive is fewer nodes. This is for when you want the number.

Pins

Pin Type Description
TargetX Number X of the point you are measuring to.
TargetY Number Y of the point you are measuring to.
TargetZ Number Z of the point you are measuring to.
Pin Type Description
Distance Number How far the voxel being sampled is from Target.

Studio and Graph › Voxel › Math

Divide

A over B. Dividing by zero, or near enough to zero, gives you 0 rather than an infinity, because an infinity reaching the mesher takes the whole chunk with it.

Divide node

The Divide node

When to use it

A over B. Dividing by zero, or near enough to zero, gives you 0 rather than an infinity, because an infinity reaching the mesher takes the whole chunk with it.

That guard has a side effect worth knowing. A suspiciously flat patch of zero in your result might be a division that tripped the guard rather than a shape. Drop a Visualize node on the wire and read the number.

When the divisor never changes, multiplying by the reciprocal is cheaper and reads better.

Pins

Pin Type Description
A Number The first number.
B Number The second number.
Pin Type Description
Result Number The answer.

Studio and Graph › Voxel › Math

Exp

e raised to the input, with the exponent clamped to plus or minus 80 so it cannot run away to infinity.

Exp node

The Exp node

When to use it

e raised to the input, with the exponent clamped to plus or minus 80 so it cannot run away to infinity.

It still grows absurdly fast. exp(20) is half a billion. This is a falloff tool, not a scaling tool: exp of a negative squared distance is the Gaussian bump you usually wanted.

A field that has gone flat and enormous is nearly always an exp with a positive argument nobody meant to feed it.

Pins

Pin Type Description
Input Number The number to work on.
Pin Type Description
Result Number The answer.

Studio and Graph › Voxel › Math

Float To Int

Converts a float to an integer by flooring it, which means it truncates toward negative infinity rather than toward zero. 1.7 becomes 1. -0.3 becomes -1, not 0.

Float To Int node

The Float To Int node

When to use it

Converts a float to an integer by flooring it, which means it truncates toward negative infinity rather than toward zero. 1.7 becomes 1. -0.3 becomes -1, not 0.

That asymmetry only bites when the value can go negative, and then it bites hard: everything below zero shifts a whole step. Add 0.5 first if you wanted nearest.

The usual reason to place one is feeding float maths into an int-typed pin such as a Seed.

Pins

Pin Type Description
Value Number The number to round down.
Pin Type Description
Result Whole Number The whole number below it.

Studio and Graph › Voxel › Math

Floor

Rounds down to the nearest whole number.

Floor node

The Floor node

When to use it

Rounds down to the nearest whole number.

Combined with a multiply and a divide it quantises a smooth value into steps, but Terrace already does that with the step size as one readable number. Come here when you actually want the integer: a cell index, a band number, the input to a hash.

Pins

Pin Type Description
Input Number The number to work on.
Pin Type Description
Result Number The answer.

Studio and Graph › Voxel › Math

Frac

The fractional part, meaning the input minus its floor. Always lands between 0 and 1.

Frac node

The Frac node

When to use it

The fractional part, meaning the input minus its floor. Always lands between 0 and 1.

Compact way to build repeating ramps and tiling patterns out of a coordinate.

Like Modulo it puts a discontinuity at every whole number. Build a field directly on Frac and the mesher faithfully reproduces that step as a wall.

Pins

Pin Type Description
Input Number The number to work on.
Pin Type Description
Result Number The answer.

Studio and Graph › Voxel › Math

If

Picks one of two inputs from a Condition, treating anything at or above 0.5 as true.

If node

The If node

When to use it

Picks one of two inputs from a Condition, treating anything at or above 0.5 as true.

It fits when the condition is already a mask, from a Compare or a thresholded noise. Branch does the comparison and the choice in one node. Select does the same thing with a soft blend.

A hard switch between two fields leaves a discontinuity at the boundary, and the mesher renders that as a step you never modelled.

Pins

Pin Type Description
True Number Passed through when Condition is 0.5 or more.
False Number Passed through when Condition is under 0.5.
Condition Number The 0-or-1 value that picks a side.
Pin Type Description
Result Number Whichever of True and False got picked.

Studio and Graph › Voxel › Math

Int To Float

Converts an integer to a float.

Int To Float node

The Int To Float node

When to use it

Converts an integer to a float.

It is a straight pass-through, since everything is stored as a float underneath. It exists so the conversion is visible on the canvas and the pins downstream stay float-typed. Adding one costs nothing at all.

Pins

Pin Type Description
Value Whole Number The whole number coming in.
Pin Type Description
Result Number The same number, now on a float wire.

Studio and Graph › Voxel › Math

Inverse Lerp

0 at Range Min, 1 at Range Max, linear between, and clamped to 0 to 1 at both ends.

Inverse Lerp node

The Inverse Lerp node

When to use it

0 at Range Min, 1 at Range Max, linear between, and clamped to 0 to 1 at both ends.

The clamp is the whole difference between this and Remap. It is what stops a value from outside the range driving a blend past its endpoints and pushing a colour or a displacement somewhere you never asked for.

Pins

Pin Type Description
RangeMin Number The input that comes out as 0.
RangeMax Number The input that comes out as 1.
Input Number The number to work on.
Pin Type Description
Result Number The answer.

Studio and Graph › Voxel › Math

Lerp

Blends A and B by Alpha. 0 gives A, 1 gives B, and Alpha is clamped so you cannot extrapolate past either end.

Lerp node

The Lerp node

When to use it

Blends A and B by Alpha. 0 gives A, 1 gives B, and Alpha is clamped so you cannot extrapolate past either end.

Fine for mixing two parameters or two masks. Select is the one you want when a threshold on a third value drives the blend.

For combining two shapes, Smooth Union. A lerp between two distance fields is not the distance field of anything, and it meshes as a mushy compromise between the two.

Pins

Pin Type Description
A Number What you get at Alpha 0.
B Number What you get at Alpha 1.
Alpha Number How far between A and B you want to land. Held inside 0 to 1.
Pin Type Description
Result Number A blended towards B.

Studio and Graph › Voxel › Math

Log

Natural logarithm. Zero or negative input returns 0 rather than an infinity.

Log node

The Log node

When to use it

Natural logarithm. Zero or negative input returns 0 rather than an infinity.

Good for squashing a range that spans orders of magnitude down to something you can look at.

The guard means the negative half of a signed field collapses to flat zero, and that half is the entire inside of your shape. Log a magnitude, not a density.

Pins

Pin Type Description
Input Number The number to work on.
Pin Type Description
Result Number The answer.

Studio and Graph › Voxel › Math

Max

The larger of A and B, which is the same operation Intersection performs, since positive means outside.

Max node

The Max node

When to use it

The larger of A and B, which is the same operation Intersection performs, since positive means outside.

Max is for numeric work: max(x, 0) to strip negatives, clamping a value by hand. Intersection is for shapes. Same maths, and a reader can tell them apart at a glance.

Pins

Pin Type Description
A Number The first number.
B Number The second number.
Pin Type Description
Result Number The answer.

Studio and Graph › Voxel › Math

Min

The smaller of A and B.

Min node

The Min node

When to use it

The smaller of A and B.

With negative meaning inside, that is exactly what Union does, and both nodes emit the same operation. Union in a boolean chain so the graph says what you meant, Min when you genuinely want the lower of two numbers.

Pins

Pin Type Description
A Number The first number.
B Number The second number.
Pin Type Description
Result Number The answer.

Studio and Graph › Voxel › Math

Modulo

The remainder of A divided by B. Stripes, rings and repeating bands built out of a coordinate. A divisor at or near zero returns 0 rather than an error.

Modulo node

The Modulo node

When to use it

The remainder of A divided by B. Stripes, rings and repeating bands built out of a coordinate. A divisor at or near zero returns 0 rather than an error.

When what you want to tile is a whole shape rather than a number, Domain Repeat is the right node. Modulo on a distance field snaps the value at every cell edge, and the mesher renders that snap as a wall.

Pins

Pin Type Description
A Number The first number.
B Number The second number.
Pin Type Description
Result Number The answer.

Studio and Graph › Voxel › Math

Multiply

A times B. The workhorse.

Multiply node

The Multiply node

When to use it

A times B. The workhorse.

Pins

Pin Type Description
A Number The first number.
B Number The second number.
Pin Type Description
Result Number The answer.

Studio and Graph › Voxel › Math

Negate

Flips the sign. On a density field that swaps solid and empty, so the inside becomes the outside. Quickest way to turn a shape into the hole it would leave.

Negate node

The Negate node

When to use it

Flips the sign. On a density field that swaps solid and empty, so the inside becomes the outside. Quickest way to turn a shape into the hole it would leave.

For carving one shape out of another, Subtraction does the negate and the combine together and keeps the result valid. This node on its own leaves you to get the max() right yourself.

Pins

Pin Type Description
Input Number The number to work on.
Pin Type Description
Result Number The answer.

Studio and Graph › Voxel › Math

One Minus

1 minus the input. The standard way to flip a 0 to 1 mask, and easier to read on the canvas than a Subtract wired to a constant.

One Minus node

The One Minus node

When to use it

1 minus the input. The standard way to flip a 0 to 1 mask, and easier to read on the canvas than a Subtract wired to a constant.

It is not how you invert a density field; Negate is. A distance field is not confined to 0 to 1, so 1 - d shifts the surface as well as flipping it and the shape comes out the wrong size.

Pins

Pin Type Description
Input Number The number to work on.
Pin Type Description
Result Number The answer.

Studio and Graph › Voxel › Math

Power

A raised to the power B, using the absolute value of A so a negative base cannot produce something undefined.

Power node

The Power node

When to use it

A raised to the power B, using the absolute value of A so a negative base cannot produce something undefined.

That guard matters more than it sounds, because a density field is negative half the time. Raise a signed field to a power and the sign quietly disappears, taking the inside of your shape with it. Shape masks with this. Leave signed fields alone.

On a 0 to 1 mask, exponents above 1 push it toward 0 and sharpen the edge. Below 1 pushes toward 1 and softens it.

Pins

Pin Type Description
A Number The first number.
B Number The second number.
Pin Type Description
Result Number The answer.

Studio and Graph › Voxel › Math

Remap

Rescales a value from one range to another, linearly.

Remap node

The Remap node

When to use it

Rescales a value from one range to another, linearly.

Most noise comes out around -1 to 1 and most things that consume it expect 0 to 1. Forgetting that is the single most common reason a pattern looks half missing: the negative half is being read as zero.

It does not clamp. Feed it something outside Input Min to Input Max and the output runs straight past Output Min and Output Max. Inverse Lerp is the clamped version, or put a Clamp after this one.

Pins

Pin Type Description
InputMin Number The input value that should come out as Output Min.
InputMax Number The input value that should come out as Output Max.
OutputMin Number What you get when the input sits at Input Min.
OutputMax Number What you get when the input sits at Input Max.
Input Number The number to work on.
Pin Type Description
Result Number The answer.

Studio and Graph › Voxel › Math

Round

Rounds to the nearest whole number.

Round node

The Round node

When to use it

Rounds to the nearest whole number.

Pick it over Floor when the quantised value has to stay centred on the original. Flooring biases everything down by half a step, and once that result drives a position you see it as a systematic shift of the whole pattern.

Pins

Pin Type Description
Input Number The number to work on.
Pin Type Description
Result Number The answer.

Studio and Graph › Voxel › Math

Sign

+1 for positive, -1 for negative, 0 for exactly zero.

Sign node

The Sign node

When to use it

+1 for positive, -1 for negative, 0 for exactly zero.

On a density field that turns a smooth distance into a hard inside-or-outside flag. Occasionally that is what a mask wants. It is always bad input for the mesher, which needs a slope to find the crossing point in. Give it a sign and the surface snaps to voxel corners.

SmoothStep is the soft version.

Pins

Pin Type Description
Input Number The number to work on.
Pin Type Description
Result Number The answer.

Studio and Graph › Voxel › Math

Sin

Sine of the input, in radians. One full cycle is 2 pi, so a value in degrees oscillates about 57 times faster than you expected and reads as noise.

Sin node

The Sin node

When to use it

Sine of the input, in radians. One full cycle is 2 * pi, so a value in degrees oscillates about 57 times faster than you expected and reads as noise.

When what you want is a ripple running along a direction, Sine Wave already handles the direction, the frequency and the amplitude.

Pins

Pin Type Description
Input Number The number to work on.
Pin Type Description
Result Number The answer.

Studio and Graph › Voxel › Math

Smooth Step

An S-curve ramp. 0 below Edge0, 1 above Edge1, smooth in between.

Smooth Step node

The Smooth Step node

When to use it

An S-curve ramp. 0 below Edge0, 1 above Edge1, smooth in between.

The standard way to turn any value into a soft mask, and better than Compare for anything that ends up visible, because the slope is continuous at both ends instead of jumping.

Putting Edge0 above Edge1 works and inverts the ramp, which saves a node when you want the mask the other way round.

Pins

Pin Type Description
Edge0 Number Below this the answer is 0.
Edge1 Number Above this the answer is 1.
Input Number The number to work on.
Pin Type Description
Result Number The answer.

Studio and Graph › Voxel › Math

Sqrt

Square root, taking the absolute value first so a negative input cannot produce nonsense.

Sqrt node

The Sqrt node

When to use it

Square root, taking the absolute value first so a negative input cannot produce nonsense.

Which also means feeding it a signed density silently throws the sign away. Square-root a squared length, not a field.

Most of the time the Vec2 Length and Vec3 Length nodes are what you were reaching for.

Pins

Pin Type Description
Input Number The number to work on.
Pin Type Description
Result Number The answer.

Studio and Graph › Voxel › Math

Subtract

A minus B. Arithmetic, not a boolean cut.

Subtract node

The Subtract node

When to use it

A minus B. Arithmetic, not a boolean cut.

To carve one shape out of another, use the Subtraction node. It computes max(A, -B) and leaves you something that is still a distance field. Plain subtraction does not.

Where this one earns its place is building expressions. noise * amplitude - z is the standard height-based terrain field, and it is exactly what both erosion nodes expect to be handed.

Pins

Pin Type Description
A Number The first number.
B Number The second number.
Pin Type Description
Result Number The answer.

Studio and Graph › Voxel › Math

Terrace

Quantises a smooth value into flat plateaus. Rice-paddy terracing on a height field. Step Size is the height of one plateau, in whatever units the input is in.

Terrace node

The Terrace node

When to use it

Quantises a smooth value into flat plateaus. Rice-paddy terracing on a height field. Step Size is the height of one plateau, in whatever units the input is in.

Pins

Pin Type Description
StepSize Number How tall each flat step is, in the same units the input is in.
Input Number The number to work on.
Pin Type Description
Result Number The answer.

Studio and Graph › Voxel › Math

Vec2 Add

Component-wise A plus B on two 2D vectors.

Vec2 Add node

The Vec2 Add node

When to use it

Component-wise A plus B on two 2D vectors.

The Vec2 family exists for the XY-plane work heightmap terrain needs. Mixing it with the Vec3 family silently drops Z, so a pattern that should climb ends up flat.

Pins

Pin Type Description
AX Number A X component.
AY Number A Y component.
BX Number B X component.
BY Number B Y component.
Pin Type Description
X Number The result's X component.
Y Number The result's Y component.

Studio and Graph › Voxel › Math

Vec2 Cross

The 2D perp-dot product, A.X B.Y - A.Y B.X. It comes out as a single number, not a vector.

Vec2 Cross node

The Vec2 Cross node

When to use it

The 2D perp-dot product, A.X * B.Y - A.Y * B.X. It comes out as a single number, not a vector.

Positive if B is counter-clockwise from A, negative if clockwise. That makes it the 2D handedness test and the sign of the angle between two directions.

Vec3 Cross is the one that gives you a vector back. Do not expect these two to behave alike.

Pins

Pin Type Description
AX Number A X component.
AY Number A Y component.
BX Number B X component.
BY Number B Y component.
Pin Type Description
Result Number Which side of A the vector B falls on. Positive counter-clockwise, negative clockwise.

Studio and Graph › Voxel › Math

Vec2 Dot

Dot product of two 2D vectors. Positive when they point the same way, zero when perpendicular, negative when opposed.

Vec2 Dot node

The Vec2 Dot node

When to use it

Dot product of two 2D vectors. Positive when they point the same way, zero when perpendicular, negative when opposed.

Normalise both inputs first if you want to read the result as a cosine. Unnormalised inputs scale it by their lengths, and the comparison you thought you were making stops meaning what you thought.

Pins

Pin Type Description
AX Number A X component.
AY Number A Y component.
BX Number B X component.
BY Number B Y component.
Pin Type Description
Result Number How much A and B point the same way.

Studio and Graph › Voxel › Math

Vec2 Length

Magnitude of a 2D vector.

Vec2 Length node

The Vec2 Length node

When to use it

Magnitude of a 2D vector.

Planar distances: how far from an axis, ignoring height. That is exactly what turns a position into a cylinder, and it is cheaper than taking a 3D length and then having to ignore a component of it.

Pins

Pin Type Description
X Number X component of the input vector.
Y Number Y component of the input vector.
Pin Type Description
Length Number How long the vector is.

Studio and Graph › Voxel › Math

Vec2 Normalize

Unit-length version of a 2D vector. A zero-length input safely returns (0, 0) rather than an error.

Vec2 Normalize node

The Vec2 Normalize node

When to use it

Unit-length version of a 2D vector. A zero-length input safely returns (0, 0) rather than an error.

That guard is why a direction built from a difference can come out as zero instead of blowing up. When a direction-driven pattern goes blank at one spot, this is usually where it happened.

Pins

Pin Type Description
X Number X component of the input vector.
Y Number Y component of the input vector.
Pin Type Description
NX Number Normalised X component.
NY Number Normalised Y component.

Studio and Graph › Voxel › Math

Vec2 Scale

Multiplies a 2D vector by a scalar. Uniform scale only.

Vec2 Scale node

The Vec2 Scale node

When to use it

Multiplies a 2D vector by a scalar. Uniform scale only.

For a per-axis scale, build it from the components. This node cannot express one.

Pins

Pin Type Description
VX Number V X component.
VY Number V Y component.
Scale Number One number that multiplies every part of the vector.
Pin Type Description
X Number The result's X component.
Y Number The result's Y component.

Studio and Graph › Voxel › Math

Vec2 Subtract

Component-wise A minus B on two 2D vectors.

Vec2 Subtract node

The Vec2 Subtract node

When to use it

Component-wise A minus B on two 2D vectors.

Usually the offset from one point to another, which then goes into Vec2 Length for a planar distance or Vec2 Normalize for a direction.

Pins

Pin Type Description
AX Number A X component.
AY Number A Y component.
BX Number B X component.
BY Number B Y component.
Pin Type Description
X Number The result's X component.
Y Number The result's Y component.

Studio and Graph › Voxel › Math

Vec3 Add

Component-wise A plus B on two 3D vectors. The usual way to offset a position before feeding it to a pattern.

Vec3 Add node

The Vec3 Add node

When to use it

Component-wise A plus B on two 3D vectors. The usual way to offset a position before feeding it to a pattern.

To move an entire subgraph's sample point, Domain Translate does it in one place instead of one node per pattern.

Pins

Pin Type Description
AX Number A X component.
AY Number A Y component.
AZ Number A Z component.
BX Number B X component.
BY Number B Y component.
BZ Number B Z component.
Pin Type Description
X Number The result's X component.
Y Number The result's Y component.
Z Number The result's Z component.

Studio and Graph › Voxel › Math

Vec3 Cross

Cross product. The vector perpendicular to both inputs.

Vec3 Cross node

The Vec3 Cross node

When to use it

Cross product. The vector perpendicular to both inputs.

Use it to build a frame, like a tangent from a normal and an up vector.

The result is zero when the inputs are parallel, which is exactly what happens at the poles of any up-based frame. Whatever you built on that frame goes undefined there.

Pins

Pin Type Description
AX Number A X component.
AY Number A Y component.
AZ Number A Z component.
BX Number B X component.
BY Number B Y component.
BZ Number B Z component.
Pin Type Description
X Number The result's X component.
Y Number The result's Y component.
Z Number The result's Z component.

Studio and Graph › Voxel › Math

Vec3 Dot

Dot product of two 3D vectors. +1 parallel, 0 perpendicular, -1 opposite, but only when both inputs are unit length.

Vec3 Dot node

The Vec3 Dot node

When to use it

Dot product of two 3D vectors. +1 parallel, 0 perpendicular, -1 opposite, but only when both inputs are unit length.

That condition is the trap. Dot a raw position against World Up and what comes back is a height, not a slope, and it keeps growing the higher you go. Normalise first whenever you want an angle.

Pins

Pin Type Description
AX Number A X component.
AY Number A Y component.
AZ Number A Z component.
BX Number B X component.
BY Number B Y component.
BZ Number B Z component.
Pin Type Description
Result Number How much A and B point the same way.

Studio and Graph › Voxel › Math

Vec3 Length

Magnitude of a 3D vector.

Vec3 Length node

The Vec3 Length node

When to use it

Magnitude of a 3D vector.

Length of position minus centre, minus a radius, is a sphere, and the Sphere primitive already computes that for you. Come here when you want the distance itself as a control value.

Pins

Pin Type Description
X Number X component of the input vector.
Y Number Y component of the input vector.
Z Number Z component of the input vector.
Pin Type Description
Length Number How long the vector is.

Studio and Graph › Voxel › Math

Vec3 Normalize

Unit-length version of a 3D vector. Zero length safely returns (0, 0, 0).

Vec3 Normalize node

The Vec3 Normalize node

When to use it

Unit-length version of a 3D vector. Zero length safely returns (0, 0, 0).

Do this before any dot product you intend to read as an angle.

The zero guard means a degenerate direction goes quietly to nothing rather than poisoning the whole field with a value the mesher cannot use.

Pins

Pin Type Description
X Number X component of the input vector.
Y Number Y component of the input vector.
Z Number Z component of the input vector.
Pin Type Description
NX Number Normalised X component.
NY Number Normalised Y component.
NZ Number Normalised Z component.

Studio and Graph › Voxel › Math

Vec3 Scale

Multiplies a 3D vector by a scalar. Uniform scale.

Vec3 Scale node

The Vec3 Scale node

When to use it

Multiplies a 3D vector by a scalar. Uniform scale.

Non-uniform scaling has to be built from the components, or done with Domain Scale when it is the sample point you want scaled.

Pins

Pin Type Description
VX Number V X component.
VY Number V Y component.
VZ Number V Z component.
Scale Number One number that multiplies every part of the vector.
Pin Type Description
X Number The result's X component.
Y Number The result's Y component.
Z Number The result's Z component.

Studio and Graph › Voxel › Math

Vec3 Subtract

Component-wise A minus B on two 3D vectors, usually to get the offset from a centre to the sample point.

Vec3 Subtract node

The Vec3 Subtract node

When to use it

Component-wise A minus B on two 3D vectors, usually to get the offset from a centre to the sample point.

Follow it with Vec3 Length for a distance, or Vec3 Normalize for a direction.

Pins

Pin Type Description
AX Number A X component.
AY Number A Y component.
AZ Number A Z component.
BX Number B X component.
BY Number B Y component.
BZ Number B Z component.
Pin Type Description
X Number The result's X component.
Y Number The result's Y component.
Z Number The result's Z component.

Studio and Graph › Voxel › Math

Vec4 Add

Component-wise A plus B on two 4D vectors.

Vec4 Add node

The Vec4 Add node

When to use it

Component-wise A plus B on two 4D vectors.

The Vec4 family is here for colour with alpha more than for geometry. For positions, Vec3 is what the rest of the graph speaks.

Pins

Pin Type Description
AX Number A X component.
AY Number A Y component.
AZ Number A Z component.
AW Number A W component.
BX Number B X component.
BY Number B Y component.
BZ Number B Z component.
BW Number B W component.
Pin Type Description
X Number The result's X component.
Y Number The result's Y component.
Z Number The result's Z component.
W Number The result's W component.

Studio and Graph › Voxel › Math

Vec4 Dot

Dot product of two 4D vectors.

Vec4 Dot node

The Vec4 Dot node

When to use it

Dot product of two 4D vectors.

Rarely a geometric question at four components. Most often it is a weighted sum, with one input acting as the weights.

Pins

Pin Type Description
AX Number A X component.
AY Number A Y component.
AZ Number A Z component.
AW Number A W component.
BX Number B X component.
BY Number B Y component.
BZ Number B Z component.
BW Number B W component.
Pin Type Description
Result Number Every pair of components multiplied, then all four added up.

Studio and Graph › Voxel › Math

Vec4 Length

Magnitude of a 4D vector.

Vec4 Length node

The Vec4 Length node

When to use it

Magnitude of a 4D vector.

On an RGBA colour this pulls alpha into the magnitude, so what comes back is not a brightness. Take the RGB as a Vec3 if brightness is what you wanted.

Pins

Pin Type Description
X Number X component of the input vector.
Y Number Y component of the input vector.
Z Number Z component of the input vector.
W Number W component of the input vector.
Pin Type Description
Length Number How long the vector is.

Studio and Graph › Voxel › Math

Vec4 Normalize

Unit-length version of a 4D vector. Zero length safely returns zero.

Vec4 Normalize node

The Vec4 Normalize node

When to use it

Unit-length version of a 4D vector. Zero length safely returns zero.

As with Vec4 Scale, normalising an RGBA colour drags alpha into the calculation. Normalise the RGB separately when that matters.

Pins

Pin Type Description
X Number X component of the input vector.
Y Number Y component of the input vector.
Z Number Z component of the input vector.
W Number W component of the input vector.
Pin Type Description
NX Number Normalised X component.
NY Number Normalised Y component.
NZ Number Normalised Z component.
NW Number Normalised W component.

Studio and Graph › Voxel › Math

Vec4 Scale

Multiplies a 4D vector by a scalar.

Vec4 Scale node

The Vec4 Scale node

When to use it

Multiplies a 4D vector by a scalar.

On an RGBA colour that scales the alpha too, which is almost never what anyone meant. Halve a colour and it comes back half transparent as well as half as bright. Scale the RGB as a Vec3 and carry alpha separately.

Pins

Pin Type Description
VX Number V X component.
VY Number V Y component.
VZ Number V Z component.
VW Number V W component.
Scale Number One number that multiplies every part of the vector.
Pin Type Description
X Number The result's X component.
Y Number The result's Y component.
Z Number The result's Z component.
W Number The result's W component.

Studio and Graph › Voxel › Math

Vec4 Subtract

Component-wise A minus B on two 4D vectors.

Vec4 Subtract node

The Vec4 Subtract node

When to use it

Component-wise A minus B on two 4D vectors.

Most useful on colours. Subtracting positions in 4D means carrying a W you probably do not want.

Pins

Pin Type Description
AX Number A X component.
AY Number A Y component.
AZ Number A Z component.
AW Number A W component.
BX Number B X component.
BY Number B Y component.
BZ Number B Z component.
BW Number B W component.
Pin Type Description
X Number The result's X component.
Y Number The result's Y component.
Z Number The result's Z component.
W Number The result's W component.