0
$\begingroup$

I am learning knowledge of "Field" in Geometry Node.

Now I try to move a cube from (0, 0, 0) to (2, 2, 2) by field type node.

  1. Add cube at (0, 0, 0)
  2. Add "position" node to get XYZ of geometry
  3. Add "math" node to add 2 meter to XYZ
  4. Input result of math node into "position" socket of a "set position" node
  5. Input cube into "geometry" socket of this node.

But it doesn't work. Any suggestion to fix this?enter image description here

$\endgroup$
2
  • $\begingroup$ Just in case you want to know what exactly happened there I gave a more in-depth explanation in my answer. $\endgroup$ Feb 9 at 10:15
  • $\begingroup$ Hi, I hope you don't mind my edit for the title. Hopefully this is more useful for others who might be searching for something like this in the future. $\endgroup$ Feb 9 at 12:01

2 Answers 2

1
$\begingroup$

You are using a Math node. It does math on scalars, shown by the grey-colored sockets.

You want to use a Vector Math node to do math on vectors, shown by blue-colored sockets.

$\endgroup$
4
  • $\begingroup$ Oh, you were quicker, but why so complicated? When you want to move all vertices uniformly, simply use the Offset in the Set Position node. You don't even need to plug something into Position, it will automatically use the positions of the vertices. $\endgroup$ Feb 9 at 9:46
  • $\begingroup$ @GordonBrinkmann Yes, yours is best practice. I am just exploring "Field Geometry Node", so choose the complicated way. $\endgroup$
    – Kaneabell
    Feb 9 at 10:06
  • 1
    $\begingroup$ I think @GordonBrinkmann was commenting on scurest's answer, not to you! :^) $\endgroup$
    – John Eason
    Feb 9 at 10:08
  • $\begingroup$ Thank you, it works! I confused vector add with scalar add. $\endgroup$
    – Kaneabell
    Feb 9 at 10:10
3
$\begingroup$

Plugging vectors (the Position node) into a float input (the Value on the Math node) will result in the XYZ values getting averaged like this:

$$f(x, y, z) = \frac{x+y+z}{3}$$

This means, your 8 input vectors will be averaged to float values so that each of the 8 points gets a single value assigned, for example in a default cube going from bottom left $(-1,-1,-1)$ to top right $(1,1,1)$ you will now have one vertex holding a value of $-1$, three vertices with $-\frac{1}{3}$, three vertices with $\frac{1}{3}$ and one vertex with $1$.

If you would now plug them into the Position node without adding anything, the floats will be converted to vectors by assigning the same value to X, Y and Z, so your cube faces get stretched into a straight line going from a single vertex at $(-1,-1,-1)$ over three vertices at $(-\frac{1}{3},-\frac{1}{3},-\frac{1}{3})$, then three vertices at $(\frac{1}{3},\frac{1}{3},\frac{1}{3})$ and finally the last vertex at $(1,1,1)$.

Adding $2$ to the float values will result in having it added to each of the previous vector components, so the straight line will go from $1$ to $3$ with inbetween three vertices at $(\frac{5}{3},\frac{5}{3},\frac{5}{3})$ and three at $(\frac{7}{3},\frac{7}{3},\frac{7}{3})$.

To add to the vectors you have to use a Vector Math node instead of a Math node. This will take the X, Y and Z components separately and add values to them. With a Vector Math node you can also decide if you want to add different values for X, Y and Z:

vector math node

The good thing about the conversion from float to vector by assigning the float to all three vector components now is, if you always want to add the same value on X, Y and Z but do not want to change the values for each channel separately, you could plug a float value into the second Vector input and would only have to change a single value:

using a single value

But the best thing about the Set Position node is: you don't need to plug in a Position node, it will automatically use the positions of the vertices if left blank. And for uniformly moving all vertices, you don't need any Vector Math as you can simply use the Offset for this (and of course you could plug a float in there as well if you don't want to change three values separately):

using the offset

$\endgroup$
3
  • $\begingroup$ +1 nice explanation, maybe you should also show how he can see the result by just plugging in the viewer-node and watching the spreadsheet data ;) $\endgroup$
    – Chris
    Feb 9 at 10:21
  • $\begingroup$ @Chris Yeah, maybe later for other people having a similar problem. I actually stopped expanding my answer when I saw the other was already accepted and it does not really seem to be totally unclear to the OP what happened. $\endgroup$ Feb 9 at 10:29
  • 1
    $\begingroup$ Very detailed answer to show how GN work inside. Thanks for your share! $\endgroup$
    – Kaneabell
    Feb 9 at 16:06

You must log in to answer this question.

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