1
$\begingroup$

Okay, I'm not entirely sure how to phrase this question but I'll give it my best shot.

I've just started learning Geometry Nodes and today I tried out a course in which I learned how to make grass appear to sway with the wind. In doing so, I used the Attribute Sample Texture node.

My question is: What does the "Result" mean? In the picture below, the 4th node from the left, the Attribute Vector Math node takes the position attribute, then adds each position vector with another vector.

Here's what I understand: say for example one of the points is [1,1,1] then I add it with [2,4,0] to get a vector [3,5,1]. This new vector is then stored in the custom attribute "mapping". Then I use the mapping attribute in the Attribute Sample Texture node... then I'm lost. What happens to each vector? How does a cloud (for example) texture affect the vectors?

Also, I've checked the documentation and I still do not understand: "The Attribute Sample Texture node evaluates a texture for every point and stores the resulting colors in a new attribute. The mapping attribute can be anything that can be converted to a 3D vector. Typically, either the name of a UV map or the position attribute is used"

enter image description here

$\endgroup$

1 Answer 1

4
$\begingroup$

Blender 2.93

The Attribute Sample Texture picks basically an RGB value from the given texture at the given point. The Mapping determines how the point in the texture is calculated.

The texture space is going from 0 to 1 by default in the X and Y direction. Then it repeats by default. That is, (0.5, 0.5) is the same as (1.5, 0.5).

In this example, we have an image with the 3 colored letters R, G, B. And a plane with Geometry nodes and 5 subdivisions. It's located at (0, 0) the world origin and has a size of 1m x 1m. The Scale and Location must be applied for the plane (Ctrl+A in Object mode)

This way the geometry points are in the range of 0 to 1 for X and Y. Z is always 0. Now we can use the position for a 1:1 mapping. The sampled color is separated into red, green, and blue attributes.

The cube for the point instances is scaled along the Z-axis depending on the red value. The black cubes have a Z scale value of 0 and are flat like a plane.

example 'R'

If you change the position to UVMap which is the default name for the UV map then this is used. Open the UV Editor and rotate the UV island and you get the following (blue is used here):

example 'B'

In your example, the position attribute (which is the location of each geometry point) is shifted by a vector (the one with the purple driver) to make them virtually wander around. This shifted position is mapped to the texture and the picked color is stored in the wind attribute which is used to rotate the geometry points.

Update: Blender 3.x and Field Nodes

Blender 3.0 introduced the fields system and many of the 2.9x nodes became legacy nodes. Then in Blender 3.2, these old nodes, including the Attribute Sample Texture node, have been removed. A replacement is the Image Texture node.

Here is example from above in Blender 3.4. It uses the new 3.4 Sample UV Surface node to map the image to the points. You need to subdive the default plane first because the node requires geometry with faces.

Blender 3.4 example

$\endgroup$
4
  • $\begingroup$ i dont know why i wasn't notified about this answer, completely missed it. Thank you so much i understand it better now $\endgroup$ Commented Sep 2, 2021 at 13:58
  • $\begingroup$ The Attribute Sample Texture node was removed from Blender 3 geometry nodes. Do someone knows how to sample textures in GN in Blender 3 instead? $\endgroup$ Commented Oct 18, 2021 at 9:54
  • 1
    $\begingroup$ @ChristophWerner You can use the Image Texture node. The early Blender 3.x versions don't have the Sample UV Surface node yet and you probably have to calculate the mapping on your own. In Blender 3.4 and higher, you can use the new Sample UV Surface node. I've added an example above. $\endgroup$
    – Blunder
    Commented Feb 21, 2023 at 12:09
  • $\begingroup$ @Blunder Thank you a lot! Great hint. $\endgroup$ Commented Feb 22, 2023 at 14:40

You must log in to answer this question.

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