On this page |

This node can be used to measure curvature, which is useful in game development workflows for determining sharp cliff-like areas in terrain, so that rocks or other items can be added to those areas of high curvature, giving the landscape a more natural look.

Measuring area is useful in character workflows, as artists can measure the polygons of characters before and after animation to determine where the polygonal mesh is highly deformed. This information can then be used to blend texture maps.

Measuring volume is often used in destruction workflows, where objects are shattered. Often very small pieces can be deleted (volume under a certain amount), as they don’t affect the overall look and can speed up simulation times. Similarly, measuring perimeter is useful for determining how large things are in 2 dimensional space. For example, this can be used for measuring the 2 dimensional footprint of a city.

Note

Besides perimeter, area, and volume, most other measurements are only applicable to polygons.

## Technical

All measured quantities can be generated as either points or primitive attributes. In both cases, the measured quantity returned for an element (point or primitive) is better understood, not as discrete readings at individual spots, but as estimated "integral" of that quantity over the element’s "share" of the surface, where a polygon’s share of the surface is itself, while a point’s share is composed of quadrilateral regions cutting away 1/3 of each triangle incident to it (the input geometry is internally triangulated if needed).

The share of a point from a (triangulated) surface is made up of 1/3 of every triangle incident to it.

What’s the integral? For a quantity varying over a surface the integral of that quantity is simply the weighted sum of all possible values the quantity takes over the surface with the weight of each value being the area of the region of the surface that has that value. For example if our surface has a total area of 3 with a region that has area 1 and value 3, and another region that has area 2 with value 5, then the integral would be 1 x 3 + 2 x 5 = 13. In particular, dividing the integral by total surface area would give the proportional average value over the surface, in our example 13/3. Of course with a smoothly varying quantities there can be infinitely many regions each infinitely small; that why the precise definition uses takes same simple idea at its limit over finer and finer regions.

Several of the measured quantities, such as curvature, gradient, or Laplacian, are only defined classically for single points on "smooth" surfaces and don’t apply to polygonal surfaces which never smooth (except for trivial flat surfaces such as a grid). But as integrated quantities, they can be interpreted as measured on an implicitly "smooth" version of the surface with corresponding point or primitive shares.

Note

All measurements work on both points and primitives for closed polygons. For non-polygons, Perimeter, Area, and Volume function only on primitives. For NURBS and Bezier curves, the evaluations are based on the polygon curve of the control points and may differ widely from the true measurements. For open polygon curves, Curvature is only available on points.

## Parameters

Group

A point or primitive group on which to report the measurements. The **Element Type** always matches the group type and the class of the generated attribute.

Element Type

The type of the elements on which to do the measurements. If a group is specified, it must be of the same type as the element type.

## Measurement

Measure

Selects the specific quantity to be measured by this operator. In each case, the returned values represent the measurements over the surface share of individual elements (if **Accumulate** is set to **Per Element**), piece to which the element belongs (if **Accumulate** is set to **Per Piece**), the entire surface/group (if **Accumulate** is set to **Throughout**).

Perimeter

Calculates perimeters of individual polygons or total boundary length of connected pieces (if **Accumulation** is set to **Per Piece** and a piece attribute is specified) or the entire geometry (if **Accumulation** is set to **Throughout**).

Technical note

If evaluated over points, the calculated perimeter for each point measures the perimeter of the region of its share of the surface as discussed above. If the accumulation is done per piece or throughout then parts of the perimeters of point surface shares that are common between two points in the same piece are excluded.

Area

Calculates the area.

Technical note

If evaluated over points, the calculated area for each point measures the perimeter of the region of its share of the surface as discussed above.

Volume

Calculates the volume.

Technical note

The calculated volume is only meaningful for closed surfaces. This is because it is estimated as the sum of signed volumes of tetrahedra with a common (automatically chosen) apex based at individual surface triangles. Open surfaces may return random looking results which may even be negative.

Centroid

Calculates the center of mass.

Note

The centroid of a piece of geometry is the center of mass of the its entire surface and not just the average position of its points. Although for a single triangle the two coincide, for more complex geometry the areas of the triangles incident to each point affect its contribution to the average.

Technical note

If evaluated on points, this option returns for each point the center of mass of that point’s "share of the surface" as described above which may not coincide with the point itself.

Curvature

Calculates various types of curvature.

Technical discussion

The complete description of the curvature of a surface at a point takes more than a single number. Briefly put, at an "ordinary" point of a smooth surface, there is a direction of movement along which the surface locally curves most sharply outwards (equiv. least sharply inwards). It turns out that if one rotates that direction around the point normal by 90 degrees one finds the direction along which the surface curves least sharply outwards (equiv. most sharply inwards). These two orthogonal directions are called the "principal" directions and their respective amounts of curving, measured as (signed) numbers are called the "principal" curvatures, where the first one represented by a larger number than the second one and with positive and negative values respectively indicating outward and inward curving. The two principal directions and their respective principal curvatures, combined, carry all the information there is about the curving of the surface at a given spot. The various types of curvatures generated by this operator are all derived from these.

Planes through surface normal cut the surface at curves of various curvatures. The largest (red) and the smallest (blue) are the two principal curvatures and their tangents at surface point are principal directions.

Gaussian

Returns the product of the two principal curvatures and measures local stretching in the sense that if the surface was supposed to be tightly covered (locally) by a flat piece of elastic fabric the parts with positive Gaussian curvature would require the fabric to stretch and those with negative values would require it to shrink.

Technical discussion

Being the product of the two principal curvatures, the Gaussian curvature is zero when one of the principal curvatures is zero which is any place where the surface is flat or locally looks like a tube (curved only in one direction but straight in the other). It is positive where the surface is elliptic (curved inwards in both direction or outwards in both direction) and negative if it is hyperbolic, or saddle like (curved inwards in one direction and outwards in the other direction).

Mean

Returns the average of the two principal curvatures and indicates whether the surface is curved more outward or inward.

Technical discussion

A zero value either means the surface is flat or it curves as much outwards in one principle direction as it does inwards in the other. Returned values are positive if the surface curves more outwards than inwards and negative otherwise.

Make Scale Independent

Normally principal curvatures scale inversely with uniform scaling of input geometry. This option returns a variant of the results which does not change if the input geometry changes scale.

Technical discussion

If the input geometry is transformed by a uniform scale factor s, then each principal curvature scales by factor 1/s while the total surface area and each element’s share of it scale by square of s. Enabling this option divides each accumulated principal curvature by the square root of its respective surface share which eliminates the dependency on scale. This option is available on all provided curvature types except Gaussian. This is because the Gaussian curvature, being the product of the two principal curvatures, scales by inverse of the square of the scale factor s and therefore always cancels out the effect of area scaling by square of s.

Principal

This option allows you to extract individual principal curvatures (as numbers) or direction (as unit vectors) or both (scaled vectors).

Note

The principal directions are reported as vectors up to a sign change, meaning that the intended direction is both the returned vector and its negation.

Report

You can choose to report either of the smaller or larger of the two principal curvatures or their respective directions. In addition you can choose to decide smaller versus large in the absolute sense to ignore whether the curving is inwards or outwards and only compare the amount of curving. If reported as **Curvature** a single number is written to the attribute for each element. If **Direction** is chosen, a unit vector in the direction of the corresponding principal direction is reported. If **Vector** is chosen, the same vector with a magnitude equal to the corresponding principal curvature is reported.

Difference Filter

Removes (zeros out) measurements for areas where principal directions are not sufficiently distinguishable from one another.

Technical discussion

In points where the two principal curvatures are equal the surface becomes locally similar to a sphere and the principal directions become ill-defined since the surface curves equally in all directions. When approximated numerically the reported principal directions at such regions can behave randomly and may appear as noise. Using the **Difference Filter** any principal directions that are not sufficiently distinguishable are set to zero.

Gradient

Calculates the gradient of a scalar (real-valued) source attribute.

This image shows the height gradient on terrain.

Technical discussion

On a smooth surface where value (function) is given everywhere, the gradient of the value at a point on the surface is a vector tangent to the surface which points in the direction along which the value increases most rapidly locally. The magnitude of the gradient vector is proportional to how fast the value increases in that direction. For example you can use the magnitude of the gradient of the height on a polygonal terrain to distinguish locally flat regions (near zero length gradients) from sloped ones (large length gradients).

Source Attribute

The attribute on which the gradient is calculated. Note that this can be a point, primitive, or vertex attribute regardless of the generated attribute class of the output attribute which is determined by **Element Type**.

Source Component

Choose the component of a vector-valued attribute to use as source.

Make Scale Independent

Normally gradient scales inversely with uniform scaling of input geometry. This option returns a variant of the gradient which does not change if the input geometry changes scale.

Technical discussion

If the input geometry is transformed by a uniform scale factor s, then the gradient scales by factor 1/s while the total surface area and each element’s share of it scale by square of s. Enabling this option divides each accumulated principal curvature by the square root of its respective surface share which eliminates the dependency on scale.

Laplacian

Calculates the laplacian of a scalar or vector source attribute. See the notes under gradient for the Source Attribute and Source Component options, as well as the option to divide the results by surface area.

Technical discussion

The Laplacian is a measure of conformity of a function to its surrounding region. Intuitively the Laplacian at a point of the surface estimates its "deficit" for evening out its value difference with its neighborhood. For example, repeatedly add a small fraction fraction of an attribute’s Laplacian has the effect of smoothing the attribute. Conversely, repeated subtracting small fractions of the Laplacian tends to sharpen the features. Note however that the Laplacian of the function changes as the values of the function are modified and unless the modifications are done in small increments the process may be unstable and can generate noise.

Source Attribute

The attribute whose Laplacian is calculated.

Source Component

Choose the component of a vector-valued attribute to use as source. You can also use **Full Vector** to compute a vector-valued Laplacian of a vector attribute.

Make Scale Independent

Enabling this option divides each returned value by its area share which turns it scale independent.

Note

When using Laplacian for smoothing or sharpening features you likely want to enable **Make Scale Independent** option which effectively replaces the integrated amounts over element shares with their respective area average amounts.

Boundary Integral

Calculates the integral of a source attribute over the boundary of each accumulation region.When **Accumulate** is set to **Per Piece** or **Throughout** all interior edges are automatically canceled out and the returned value for each piece will be a sum over the boundary edges of the products of the length of each edge and the attribute value across that edge. If the source attribute is a primitive attribute, its value across an edge is the same as its value on the primitive to which the edge belongs. If it is a point or vertex attribute then its value across the edge is the average of its values at the two ends.

For example, if the attribute has value 1 on all primitives, the boundary integral on each piece produces exactly the same output as measuring perimeter.

Integration Mode

When integrating vector-valued source attributes, this parameter allows you to choose how the attribute is interpreted at each edge.

Component-wise

Each component of a vector-valued attribute is integrated independently, producing vector-valued results.

Tangent Component

The value integrated at each edge is the dot product of the attribute vector and the unit direction vector of the edge. This corresponds to the mathematical notion of a "line integral". The result will be real-valued.

Normal Component

The value integrated at each edge is obtained by subtracting the tangent component of the vector along the curve from the attribute, effectively making it orthogonal to the curve before integrating. The result will be vector-valued.

Surface Integral

Calculates the integral of a source attribute over each accumulation region. The returned value for each accumulation region will be a sum over all the elements in that region of the product of their surface share times their source attribute value. The integration Mode work as in the case of Line Integrals.

Note

In this case, using the **Normal Component** with a vector attribute would generate a scalar output and the tangent component while the tangent component generates a vector valued output.

Accumulate

Chooses what the accumulation regions.

Per Element

The output attribute will calculate a result for each element corresponding to its share of the surface.

Per Piece

Given a piece attribute, the output attribute will have for each element the integrated result for the entire piece to which it belongs. Note that this means that all elements in the same piece receive the same output value. For example calculating the are per piece would assign to each output primitive the whole area of the piece to which it belongs.

Throughout

Similar to **Per Piece** only with the entire geometry (or Group if specified) treated as a single piece.

Position Attribute

If optionally specified, this attribute would override `P`

for calculating all the measurements. It can be a point or vertex attribute. For example the calculations can be done on uv or a rest position.

## Visualized Range

The Measure 2.0 SOP comes with a dedicated visualization state. You can enter the state by pressing enter in the viewport when the node is selected. By default, visualization parameters do not cause the operator to cook and are only used for visualization. However if **Bake Visualization Range Into Output** is set or a **Range Group** is generated, then these parameters also trigger recooking when modified. Scalar values are visualized as colors with a color ramp used to select the colors assigned to each part of the value range. Vector attributes are visualized by vectors of fixed length but with colors that represent the magnitude of the vectors.

Minimum

If set clamps the output range by the specified minimum. Any output value (magnitude for vectors) smaller than the specified minimum will be clamped the minimum value.

Maximum

If set clamps the output range by the specified maximum. Any output value (magnitude for vectors) greater than the specified maximum will be clamped the minimum value.

Width

If enabled, the output range is additionally clamped centrally to within half the specified width from a **Center** value. The accompanying menu optionally multiplies this width by a statistical measure of the range of values.

x 1.0

Uses the specified width as is.

x SD

Multiplies the width by the Standard Deviation of the raw range of values (or the raw range of magnitudes for vectors).

x MAD

Multiplies the width by Median Absolute Deviation of the raw range of values (or the raw range of magnitudes for vectors).

Center

Specifies the center value for central clamping.

Fixed

An explicit center is specified.

Mean

The average of the raw output range (or magnitudes of vectors) is used as center.

Median

The median of the raw output range (or magnitudes of vectors) is used as center.

Color mapping

The clamped range is mapped linearly onto the color ramp. The visualization of this node also displays a histogram indicating the concentration of the values along the raw range and how this overlaps the color ramp.

Vector Scale

When the output type is of vector type, this parameter controls the scale at which the vectors are drawn in the viewport. Note that a unit vector is displayed at an automatically selected base scale to avoid clutter in the viewport.

## Output

Attribute Name

The name of the attribute to be generated. Note that if the generated name is the default for some measure type, then switching the measure replaces the default attribute name to match the modified measure using a parameter script. Custom names are not changed by this script.

Total Attribute Name

If enabled, a detail attribute will be generated which will hold the total measured quantity over the entire detail (or Group if specified).

Note

This value is equal to the results generated in the output attribute if **Accumulate** is set to **Throughout**. The difference is that using the total attribute the value is written a single time as a detail attribute as opposed to being written identically to all elements.

Range Group

If enabled, elements whose raw calculated measured values fits within the visualized range, i.e. those that have not been clamped, are reported in the specified group.

Bake Visualized Range Into Output

If enabled, the same clamping that happens for visualization is also applied to the output values.

Remap Range

If enabled, the (optionally clamped) range of output values (or their magnitudes for vectors) is remapped linearly to match the given minimum and maximum. This option is available if the visualization is being baked into the output.

## Examples

MeasureArea Example for Measure geometry node

This example demonstrates how to create groups based on the area of a primitive using the Measure SOP.

MeasureLaplacian Example for Measure geometry node

This example demonstrates how to measure the Laplacian to smooth or sharpen an attribute.