# How to put an attribute value in "from Min" from "Attribute map range" node?

Is it somehow possible to put an attribute value in From Min/From Max?

What i want is to have control over e.g. scales of all distributed instances.

i want to scale them randomly...

e.g. from start frame between 20 to 100 and with end frame between 120 and 150 and scale randomly.

So every instance should scale different (different time + duration).

• I think not. Those are fixed float parameters, not per-element. Can you give an idea of your particular case? Maybe there's another way. Commented Jun 15, 2021 at 10:32
• Not as far as I know. Commented Jun 15, 2021 at 10:33
• @RobinBetts: i improved my question. See example here: [1]: i.sstatic.net/c9y8y.gif. there i scaled each individually randomly...but it was a pain in the ass with a lot of nodes :( if i could have attributes, it would be much easier Commented Jun 15, 2021 at 10:49

The Map Range operation is basically a shortcut to a number of mathematical atomic operations.

You can emulate its behaviour by using regular Attribute Math Nodes.

Using the formula from the first link I suggested, I laid out the algorithm :

output = output_start + ((output_end - output_start) / (input_end - input_start)) * (input - input_start)
<=>
output = To Min + (To Max - To Min) / (From Max - From Min) * (input - From Min)


We then just need to do the operations linearly.

Let's create a node group in order to reuse it wherever we want.

First operation, calculate input - From Min

Then, From Max - From Min

To Max - To Min

(To Max - To Min) / (From Max - From Min)

(To Max - To Min) / (From Max - From Min) * (input - From Min)

Finally, (To Max - To Min) / (From Max - From Min) * (input - From Min) + To Min :

for the sake of tidiness, remove the unneeded attributes, and output the geometry.

Here's a simple setup to generate a bunch of attributes to test out our node group.

Plug everything up, and use a control regular Map Range node to test it.

Use the new Spreadsheet Editor to analyse the data.

It's the same, yay !

Caveats, possible improvements :

• This group only accepts attributes. You could theoretically tweak it to accept floats with a Switch node (Blender 3.00 +), but the sheer number of possible configurations would make the node group very big and convoluted.
• This is a linear interpolation, meaning you would need to change the algorithm to add a damping coefficient if you want a smoother interpolation.
• Add an Attribute Clamp node at the end if you want the possibility to clamp output

Grab the file to test out the node group :

and here the attribute clamp node:

• looks very promising...i check this out...!! Commented Jun 15, 2021 at 11:14
• Of course. Perfect. Commented Jun 15, 2021 at 11:15
• That's amazing! Thank you Gorgious! Works perfect...!! Just a little comment ;) The attribute clamp as it is wouldn't help, because it doesn't allow attributes in min and max, right? so i would have to "rebuild" this on my own like you did with the map range node. Or am i missing something? Commented Jun 15, 2021 at 11:30
• @Chris Sure thing, thanks :) Commented Jun 15, 2021 at 12:19
• by the way: your answer freed me from felt 40 superfluous nodes....! ;) Commented Jun 15, 2021 at 12:20