And i want to scale UV Sphere depending on its position on Z axis for example. With attribute node that was done in 1 operation and now i cannot find solution, using Separate XYZ and Scale Instances in any configuration.
2 Answers
Four you example, just use the output of the Noise texture to drive the scale of the Instance on Points Node, since it already drives the Z location. Here's a crude version:
Since you want to keep the sphere shape, plug all the noise value into all three sockets of a Combine XYZ and use that to drive scale.
I didn't put any math in the path, but yo can add math nodes to control the range of scales.
-
2$\begingroup$ You don't need the Combine XYZ nodes if you don't want to combine different values. Plugging a float value into a vector socket automatically enters the float into all fields of the vector. $\endgroup$ Commented Jan 17, 2022 at 22:22
-
$\begingroup$ Sure, but note that I mentioned you could add math nodes. I wanted to make it obvious you could control each dimension's scaling separately. $\endgroup$ Commented Jan 18, 2022 at 0:29
As an attentive reader, I can provide you with an answer that, unlike MF's existing answer, actually works. ...
Since you use the node Noise Texture
, it will be evaluated twice here:
- Once at the point where you use
Set Position
to change the positions of the grid. - And a second time when you use
Instance on Points
to instantiate your objects at the points.
So you get two different values.
To avoid this problem, the following solutions are available:
Variant 1
Here I capture the values of the output Fac and store them with Capture Attribute
into the geometry.
I can then use these values directly when instantiating the objects.
Variant 2
Here I query the positions of the points, after these were changed by Set Position
.
With this I also get the desired result.
PS: In both examples I also use Map Range
to control the scaling more precisely. Change the values there according to your taste.
...And if you do it as shown in the other answer, you will get a nice thing, but the scaling is definitely not dependent on the Z-position. Fun in theory, not in practice.