3
$\begingroup$

I'm making a mosaic using geometry nodes, and I'm trying to make each stone a singular color from a texture. Currently I'm able to project an image texture onto the object, which looks pretty good, but it makes each stone multiple colors rather than each stone being one color. I know how to do a random color based on island, but I would like to pull color from an image texture instead.

My Cobblestones

Think of these Iberian mosaic cobblestones.

Iberian Mosaic Cobblestones

There is slight variation of the three colors in this mosaic, but each stone is distinctly one color rather than a stone between two colors having more than one color. I know the size and placement of each stone in real life is exact and specific based on the design, but I'm not too worried about the details like that for this.

Is it possible to get the average color of the texture at the center of a mesh island, or any single color from the texture within the mesh island? It doesn't have to be too exact, just an overall simplification of an image to have one color per mesh island that has been created by the geometry node -- without having to manipulate the texture in photoshop.

I'm thinking of the way the mosaic effect in photoshop gets an average color of an area and makes it into a square, but I'm not sure how I would translate that to irregular sized and shapes meshes.

This is my blend file:

Thank you

$\endgroup$
2
  • $\begingroup$ You need to scale each separate pebble UV island to 0, so it will basically only sample a single pixel from your image texture $\endgroup$
    – Gorgious
    Jan 20 at 7:46
  • $\begingroup$ Does this answer your question? blender.stackexchange.com/questions/268934 $\endgroup$
    – quellenform
    Jan 20 at 10:03

1 Answer 1

4
$\begingroup$

If you simply scale the individual elements to $0$ and then transfer their positions to your mesh with Sample Index, all elements will receive exactly the average position.

You can then use this as a basis with Attribute in the shader and evaluate a color at a single position:

enter image description here

PS: If you use a lower version than 3.4, then you need the node Transfer Attribute instead of Sample Index.


(Blender 3.4+)

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .