1
$\begingroup$

Let's say, in geometry nodes I have a vector field that is obtained from Color output of the Noise Texture. Now I want to restrict its x, y, z values to make them lie only within the range of 0 and 1. I can, of course, use the Map Range node, but it requires the input value range, and for this I will have to use something like Attribute Statistic to get get min and max of each of the x, y, z values of the vector. I want to avoid it if possible.

So, what is the simplest way I can restrict the value of a field to make it lie within a range (like 0 to 1) regardless of the input value range?

Edit: As pointed out by @Nathan in the comment, noise output is already within the range of 0-1. So the example in my original question should be changed to anything other than 0-1, let's say 0-0.5. My question is given any arbitrary input range, can we restrict the output to a fixed range without requiring the minimum and maximum values of the input range?

$\endgroup$
5
  • 1
    $\begingroup$ Are you looking for math/minimum and math/maximum? Simple ways to clamp anything, including an attribute. Or you are looking to normalize the ouput around all possible values? Not doable in GN-- requires image processing techniques, and may only be valid for certain domains and sampling rates. Note that noise texture output lies within 0,1 anyways. $\endgroup$
    – Nathan
    Jan 5, 2023 at 5:31
  • $\begingroup$ @Nathan Thanks, I have edited the question to change the example range for noise texture. I am not sure if math/min would help in this case. Please have a look at the edit. $\endgroup$ Jan 5, 2023 at 7:05
  • 1
    $\begingroup$ Are you aware of the clamp node ? docs.blender.org/manual/en/2.93/modeling/geometry_nodes/… Separate XYZ > 3*Clamp > Combine XYZ $\endgroup$
    – Gorgious
    Jan 5, 2023 at 7:27
  • $\begingroup$ @Gorgious Could you post your reply as an answer, so that I can accept it. $\endgroup$ Jan 6, 2023 at 9:58
  • $\begingroup$ Sorry don't have the time right now. But You can answer your own question with your solution. Cheers :) $\endgroup$
    – Gorgious
    Jan 6, 2023 at 10:36

2 Answers 2

1
$\begingroup$

As Gorgious correctly pointed out in the comments, you can solve this by splitting the vector into its components and using the Clamp node for each float value:

enter image description here

Alternatively, you can use the vector nodes Minimum and Maximum directly:

enter image description here

By the way: The node Noise Texture should actually always return a value between $(0,0,0)$ and $(1,1,1)$, and therefore this should not be necessary in this case.

$\endgroup$
1
$\begingroup$

I prefer @quellenform's versions, because they're more explicit, and readable, but I don't see your problem with using the clamped output of Map Range. So long as the input range is the same as the clamped output range, and the interpolation is 'Linear', you wouldn't need any further information from Attribute Statistic ?

enter image description here

I don't need to know anything about this Suzanne, to keep her within the unit cube:

enter image description here

$\endgroup$

You must log in to answer this question.

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