2
$\begingroup$

I'm trying to convert the direction of a specific set of edges of a shape to point data, so that it is smooth when used in a shader. However I can't seem to figure out this conversion. Here's what my Geonodes are looking like so far:

1

In this attempt the direction for each edge is calculated with some simple vector math, then a selection of the horizontal edges is made. The edge directions of this selection are fed into an attribute called "horizontals". These "horizontals" are fed directly into a shader. This gives a consistent checkered pattern instead of a smooth gradient like I want. Setting the "Store Named Attribute" node to "Point" makes everything black.

From what I understand this is where sampling can come in handy, however the result is far from desirable:

2

Here the aforementioned edge selection is used in a "Separate Geometry" node so that it can be sampled. This gives a somewhat messy gradient while it should be smooth. Also, when moving the vertices up and down (no rotating) in Edit Mode there is jittering, making it unreliable.

How do I make this conversion properly?

$\endgroup$
4
  • 1
    $\begingroup$ How do you want to define which way round the edge vectors are? (Which ones point at the points, which ones point away) $\endgroup$
    – Robin Betts
    Aug 10, 2023 at 14:06
  • $\begingroup$ @RobinBetts Are you asking this so that each vertex has its own edge with a direction? It's fine if they follow the Y-axis for example, even if that creates a weird seam down the middle it would still be a big step forward. I hope I understood and answered your question right. $\endgroup$ Aug 10, 2023 at 17:36
  • 1
    $\begingroup$ In this illustration the blue arrow points in the direction of vector, and the green arrow points in the direction abs(vector), This doesn't look like the relation you probably want. I think you have to come up with a definition of which end of an edge is at the start of your 'direction', and which end is at the end of it. Of course, I might be misunderstanding your intent. $\endgroup$
    – Robin Betts
    Aug 10, 2023 at 17:39
  • 1
    $\begingroup$ @RobinBetts This set of edge data isn't all that useful, you're right. However my intended focus for this question was on converting edge data to point data. The actual edge data I want to convert to point data is different from the edge data on this page but the problem I'm experiencing is the same: I get the same checkered pattern or bad sampling. $\endgroup$ Aug 10, 2023 at 20:41

2 Answers 2

0
$\begingroup$

I found something: 1

By using the selection to multiply the vectors instead of using it as a selection in the "Store Named Attribute" node we get a new vector field where the horizontal edges are included and the other edges are set to 0. Then by using an "Evaluate on Domain" node set to "Edge" and plugging it into the "Store Named Attribute" node set to "Point" we can make the conversion from edge to point data. However this shortens our horizontal edge vectors, but by using a "Normalize" node we can counteract this.

By using a "Normalize" node the length of the vectors is lost, but for my case that isn't an issue.

$\endgroup$
0
$\begingroup$

I think you are looking for the evaluate on domain node (or interpolate domain node in older Blender versions), or capture attribute etc. to change from point to edge and edge to point you just set the evaluate on domain, capture attribute, or store name attribute to the point domain.

in your case you could probability just set the store named attribute node to the point domain. if this doesn't work, then use an evaluate on domain node set to edge before.

$\endgroup$

You must log in to answer this question.

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