> For the complete documentation index, see [llms.txt](https://scenegroup.gitbook.io/cavalry/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://scenegroup.gitbook.io/cavalry/nodes/behaviours/material-sampler.md).

# Material Sampler

### Summary

The **Material Sampler** samples an **Input Shape** and then outputs values of between 0-1 depending on the value (lightness/darkness) of the shape (e.g. black = 0, white = 0). Alternatively it will output the color if connected to an attribute that supports it (e.g. **Fill Color**).

It can be used in combination with [Shaders](/cavalry/nodes/effects.md) to control attributes for other shapes and is particular useful when used alongside a [Duplicator](/cavalry/nodes/shapes/duplicator.md).

### UI

[Common Attributes](/cavalry/nodes/behaviours/common-attributes-behaviours.md) +

**Value** - a multiplier.

**Input Path** - connect a Shape with a Material to sample from.

**Graph** - use the graph to remap the output values.

**Offset** - add/subtract a value to the output(s).

{% hint style="info" %}
Example usage:

1. Import an image. to the [Assets Window](/cavalry/user-interface/menus/window-menu/asset-window.md).
2. Drag the image into the [Scene Window](/cavalry/user-interface/menus/window-menu/scene-window.md) (this will create a [Footage Shape](/cavalry/nodes/shapes/footage-shape.md)).
3. Create a **Material Sampler**.
4. Connect ***footageShape.id > materialSampler.inputShape***.
5. Create a [Rectangle](/cavalry/nodes/shapes/basic-shape/rectangle.md).
6. With the **Rectangle** selected, click the Duplicator [Shelf](/cavalry/user-interface/menus/window-menu/shelf.md) item.
7. Connect ***materialSampler.id > duplicator.shapeScale***.

The shapes will be scaled dependent on the image.
{% endhint %}

{% hint style="warning" %}
The **Material Sampler** does not currently support **SkSL Shaders** (this includes the [Noise Shader](/cavalry/nodes/effects/noise-shader.md)).
{% endhint %}

{% hint style="warning" %}
The Material Sampler does not currently support frame changes when used within a **Pre Comp**. Please try and use a [Group](/cavalry/nodes/shapes/group.md) instead of a [Composition](/cavalry/nodes/shapes/comp-node.md) if possible as a workaround.
{% endhint %}
