Scale Match instances Tutorial:
The idea of this setup came to me when I was working on an arch viz project and one of the task was to create fountains in random sized little scattered ponds and the fountain size should match the pond size.
So I started messing around with particle flow data operator and I found the in can read a mesh average size and that solved everything.
1- The first thing you wanna do is import the lake's mesh into particle flow and if all the lakes are collapse into a single mesh then you should tick the (Object Elements) option so this way it will read every element as a separate object.
2- Second we will add a data operator which inside we are going to read each element size and be able to manipulate it, and to do so we:
- Add (Input Standard node) and choose Size option and we set it to Average, so we tell it to read the input mesh average size.
- We divide that size on a 100 to make it a percentage since it's going to be a big number.
- It's always a good habit to add a multiplier so we can adjust the scale later, in my example it's set to 1.
- Last we want to output the result to use it later to drive the scale of the shape we will add. And pay attention to choose Global data access
because we are going to use it in another data operator. And also it's very important to add a (New In Event) which is an (Input Standard
Node) and link it to the first node we add, what it does that it make our network only evaluate once when the particle enter the event, and
this very important or else the scale of the geometry will be evaluated every frame and in case we have a multiplier of 0.5 that will make
the size shrink by half every frame.
3- Third let's close data operator window and add an (Instance shape operator) and pick our object that we want to instance (in my case it's a plane with a fountain texture on it), this operator will overwrite the ponds circle shape and replace it with the instanced one.
4- Fourth we add a second data operator which will read the scale we exported from the first one.
Let's add an (Input Custom Node) and when we hit the data channel button we should be able to see the output we exported earlier, then we add an (Output Standard Node) and we set it to Scale Average and we link the two node together.
5- It's done for now, if you didn't see the effect try to scrub through your timeline just for pflow to update.
And you might need to re orient your object so add a rotation operator at the end.
One might argue why didn't I just in the first data operator directly assigned the aquired scale number and linked it to (Output standard Scale), instead of using two data operator. Well I tried but failed, as if you are telling pflow to read it and write it at the exact same time. So if you have another idea or way please do share it with me.
I really enjoyed writting this tutorial, I'm looking forwards for your feedback.