How to Assign Different Materials to Geometry Nodes Tiles Based on Image Pixel Colors
To assign different materials to tiles in Blender Geometry Nodes, sample your image at each tile’s center, convert the sampled colors into selection masks, and use those masks to place tiles with the corresponding materials. Assigning the materials before instancing keeps every face of each tile consistent.
This tutorial builds a small, flat mosaic using a three-color control image. Red pixels select a cream material, green pixels select a teal material, and blue pixels select a copper material. The image controls material choice; its colors do not need to match the finished tiles. The node names and settings below target Blender 4.5 LTS.
1. Prepare an image that clearly identifies each material
Begin with an opaque, lossless PNG measuring exactly four pixels wide by three pixels high. In an image editor, enter this deliberately asymmetric pattern, reading each row from left to right:
| Image row | Pixel 1 | Pixel 2 | Pixel 3 | Pixel 4 |
|---|---|---|---|---|
| Top | Red | Red | Green | Blue |
| Middle | Green | Blue | Blue | Red |
| Bottom | Blue | Green | Red | Green |
Use pure red #FF0000, green #00FF00, and blue #0000FF. Keep all pixels fully opaque and avoid soft edges. This tiny image is an illustrative control map: its unequal row patterns make rotation, mirroring, and missing tiles easier to spot.
Create three Blender materials named Cream, Teal, and Copper. Give them clearly different Base Colors. For a visible surface difference, try Roughness 0.7 for Cream, Roughness 0.2 for Teal, and Metallic 1.0 with Roughness 0.3 for Copper. These are suggested artistic settings, not measured material properties.
Use separate materials when the tiles need different shader settings or node networks. If your only goal is to reproduce every image color through one shared shader, that is a different workflow; this setup deliberately selects between three complete materials.
2. Build a grid with one point for each image pixel
Add a mesh object, open the Geometry Nodes workspace, and create a new node group. You will generate the mosaic inside this group, so leave the Group Input geometry disconnected.
Add a Grid node with Vertices X set to 4, Vertices Y to 3, Size X to 3, and Size Y to 2. The grid supplies twelve vertex positions for the twelve tiles. Its faces are only incidental: the instancing step uses its points. Blender’s Grid Node documentation defines the size inputs as side lengths and the vertex inputs as counts along each axis.
These settings produce one-unit spacing. The centered grid’s X positions run from -1.5 to 1.5, and its Y positions run from -1 to 1. Later, a tile width of 0.9 will leave a 0.1 gap between neighbors.
For a larger image measuring W by H pixels, with both dimensions at least two, use W and H vertices. With tile-center spacing s, set the grid dimensions to (W - 1) × s and (H - 1) × s. This construction makes the geometry resolution an explicit choice: one grid point represents one image pixel.
3. Map tile positions to image pixel centers
Add a Position node. Because the resulting color masks will connect to the instancers’ point selections, the position field will be evaluated at the grid points. Blender documents Position as the location of the element where the field is evaluated, with domain-dependent behavior. See the Position Node documentation.
For this four-by-three example, build the following coordinate chain:
- Connect
Positionto aVector Mathnode set toAdd. - Set its second vector to
(2, 1.5, 0). - Connect that result to another
Vector Mathnode set toMultiply. - Set its second vector to
(0.25, 0.33333333, 0). - Connect the result to the
Vectorinput of a Geometry NodesImage Texturenode.
The calculation is u = (x + 2) / 4 and v = (y + 1.5) / 3. It places samples at horizontal coordinates 0.125, 0.375, 0.625, and 0.875, and vertical coordinates approximately 0.1667, 0.5, and 0.8333. Those are the pixel centers. The Vector Math documentation confirms that Add and Multiply operate component by component.
Open your PNG in Image Texture, set interpolation to Closest, and choose extension Extend. Closest samples without interpolation, which preserves discrete control colors. Extend repeats edge pixels outside the image boundary; the intended coordinates here remain inside it. The node outputs sampled Color and Alpha, as described in Blender’s Image Texture Node documentation.
The general mapping for the centered grid above is u = x / (W × s) + 0.5 and v = y / (H × s) + 0.5. Dividing by the full pixel count, rather than the grid’s side length, creates the half-pixel inset at both edges.
4. Turn sampled colors into three exclusive selections
Connect the image’s Color output to Separate Color and select RGB mode. This exposes the Red, Green, and Blue channels individually. These outputs are defined in the Separate Color Node documentation.
Create six Compare nodes, each using the Float data type, and three Boolean Math nodes set to And. Build these selections, where R, G, and B mean the corresponding channel outputs:
| Selection | First comparison | Second comparison | Assigned material |
|---|---|---|---|
| Red | R >= G |
R >= B |
Cream |
| Green | G > R |
G >= B |
Teal |
| Blue | B > R |
B > G |
Copper |
For each comparison, connect the channel on the left to input A and the channel on the right to input B. Choose Greater Than or Equal for >= and Greater Than for >. Connect each row’s two comparison results to its own And node. Blender documents these operations in Compare Node and Boolean Math Node.
This is an explicit classification rule: the largest channel chooses the material, and ties favor red before green before blue. Consequently, every ordinary RGB sample selects exactly one branch. For example, yellow selects Cream, cyan selects Teal, and neutral gray selects Cream. These outcomes follow from the rule; they are not a universal interpretation of those colors.
For the pure-color test image, the choices are unambiguous. For photographs or arbitrary palettes, decide whether dominant-channel classification actually matches your design before using this graph. It does not identify objects or infer material types from an image.
5. Assign materials to the tile meshes, then instance them
Add a Cube node and set Size to (0.9, 0.9, 0.15). Leave its vertex counts at 2 on all axes. This produces a shallow tile with gaps around its neighbors. The Cube Node documentation describes Size as the side lengths along the three axes.
Connect the Cube’s Mesh output to three separate Set Material nodes. Choose Cream on the first, Teal on the second, and Copper on the third. Leave each node’s Selection enabled for the entire mesh. Set Material changes the material assignment of selected faces, as explained in the Set Material Node documentation.
Add three Instance on Points nodes and connect them as follows:
| Instancer | Points input | Selection input | Instance input |
|---|---|---|---|
| Cream tiles | Grid Mesh | Red And result | Cream Set Material output |
| Teal tiles | Grid Mesh | Green And result | Teal Set Material output |
| Copper tiles | Grid Mesh | Blue And result | Copper Set Material output |
Leave Pick Instances disabled, Rotation at zero, and Scale at (1, 1, 1). Each instancer now places its prepared tile only at matching points. Blender’s Instance on Points documentation confirms that a false Selection skips a point and a true Selection generates an instance.
Connect all three Instances outputs to Join Geometry, then connect its output to Group Output. Do not also join the original Grid mesh, because it would add a continuous surface beneath the tiles. Join Geometry accepts multiple geometry inputs, as documented in Join Geometry Node.
6. Check tile count, orientation, and material independence
Switch to Material Preview and use a top view looking down the positive Z axis toward the mosaic, with positive Y upward. Compare the three visible rows against your source image. The expected result is twelve tiles: four Cream, four Teal, and four Copper. Counts alone cannot establish orientation, so also check the asymmetric row pattern.
Make one controlled edit: change the image’s top-left pixel from red to blue, save the PNG, and reload it in Blender. Only the top-left tile should change from Cream to Copper. Next, temporarily change the Copper material’s Base Color. All Copper tiles should change together, while the other tiles retain their materials.
These two checks establish different things. The pixel edit tests coordinate mapping and selection. The material edit tests whether the correct material is attached to each tile variant. Lighting and reflections can change apparent brightness, so judge the pattern and the shared response to a material edit.
7. Diagnose mismatches before increasing the resolution
| Visible problem | Check and correction |
|---|---|
| Every tile uses one material | Check the image selection, coordinate connection, RGB outputs, and the three different materials on Set Material. |
| Some positions contain no tile | Verify both comparisons in each mask, especially the distinction between > and >=. |
| Tiles overlap at some positions | Restore the exclusive tie rules; using >= everywhere allows multiple branches to select tied colors. |
| The pattern is vertically mirrored | After computing v, replace it with 1 - v; leave u unchanged. |
| The pattern repeats | Check the coordinate formula and confirm that extension is not set to Repeat. |
| Borders contain unexpected material choices | Confirm Closest interpolation and pixel-center coordinates. |
| All tiles appear plain gray | Check Material Preview and the material assigned to each prototype branch. |
Keep the first test image opaque. The current graph does not use Alpha, so transparent pixels are still classified by their RGB values. If transparent pixels should leave empty positions, compare the image’s Alpha output with 0.5 using Greater Than, then And that result with each of the three existing masks.
Keep the output instanced while checking the mosaic. If a later operation requires individual mesh geometry, add Realize Instances after Join Geometry. Blender notes that realization converts instances into real geometry and can substantially increase processing cost for complex repeated meshes. See Realize Instances Node.
Once the twelve-tile pattern passes both checks, increase the image dimensions and update the grid counts, grid sizes, and coordinate multipliers together. The useful invariant is one sample at each tile center, one selected branch per sample, and one complete material on the chosen tile.
Sources
- Image Texture Node — Blender 4.5 LTS Manual
- Grid Node — Blender 4.5 LTS Manual
- Position Node — Blender 4.5 LTS Manual
- Vector Math Node — Blender 4.5 LTS Manual
- Separate Color Node — Blender 4.5 LTS Manual
- Compare Node — Blender 4.5 LTS Manual
- Boolean Math Node — Blender 4.5 LTS Manual
- Cube Node — Blender 4.5 LTS Manual
- Set Material Node — Blender 4.5 LTS Manual
- Instance on Points Node — Blender 4.5 LTS Manual
- Join Geometry Node — Blender 4.5 LTS Manual
- Realize Instances Node — Blender 4.5 LTS Manual