(light music)
- [Narrator] So I wanted to walk through an example
with you guys on the Max Creation Graph.
This one was cooked by Martin Covin
and I just wanted to walk through it with you
to kind of rebuild it from scratch
and kind of show how it works.
So you can see that we've got an object here with
an MCG color byte distance modifier sitting on it.
And it's pointing to this little null helper.
And based off of the falloff distance
if I move this guy around
it writes information to the vertex color channel
based off of the distance so it's linearly interpolating
between white and black based off of that distance
and then with some other parameters that you can modify.
So let's go ahead and start.
If I go up to the scripting tab
and open up the,
the graph editor, let's go ahead and create this thing.
So we know first and foremost that this thing's
gonna be a modifier so if we pull up the X key
I can do a quick search for output modifier.
And then we know that we're going to
be having some parameters that we're needing
to pull from this node that's in the scene.
So if we grab a parameter I-node
that's gonna work through the user interface.
We can call this thing node.
Where we see here that we can point to an object
to help or whatever the deal is
and grab some information about it.
We also need to know where it is in space
and to do that we'll pull up another node.
Gonna grab modifier matrix.
So to calculate the distance of where this guy is
to our object and
from the vertices to that object,
let's grab another kind of pre-rolled compound.
This is mesh-porous vertex to distance.
We can pull that out so we can see that guy a little bit.
And we can hook these guys up here.
So this is really kinda doing our heavy lifting here.
Let's put this just into a group.
And groups are kinda nice because it allows us
to label things, we'll just call this the,
the distance part.
You know, so if you have a whole series
of nodes or if you're sharing a graph with
somebody else or you haven't dealt with it for a long time
it's kind of nice to be able to
get back in there and know what part's doing what.
The grouping allows you to fairly easily
grab a series of nodes, throw them all in there
if they're some associated piece of functionality
and give it some information.
So the next part that we need to do
is we've gotta take that distance information
and we're going to be modifying it
just a little bit based off of the parameters
that we see here in the UI.
So let's pull in another node,
we're gonna pull in an affect region.
And so this, the single information that we're getting here
is the distance and, as we saw in our UI,
we've got a falloff bubble and pinch
and those are all parameters in the UI
so we need to propagate those and we need to be able to
get that information in and we do that with parameter.
In this particular case we're gonna do a parameter single
so we've got a float and as you can see
we've got inputs for minimum/maximum
and whatever default value that you might
wanna be working in.
And so let's just call this falloff.
And instead of digging through and finding
multiple of these guys,
we can just hit shift and drag and we can do
a copy of that.
We'll do
a bubble.
And one for pitch.
Let's hook these guys all up into those inputs.
Because they're taking a little bit of space
and we don't really need to deal with them too terribly much
let's just collapse these guys down.
Get them out of the way.
Okay, so now we've got our distance
and we're affecting it by these input parameters.
And now we need to do something with it.
And what we wanna do is we want to
interpolate a black to white color based off of this
distance information so there's another compound
that somebody had cooked up.
So we have some blend options
and let's just do a blend black to white.
So we're gonna grab that amount
and now this guy's going to linearly
interpolate between black to white
based off of that information.
And we can dig into this compound
if we right click and we can open it up
in a different window.
And you can see that under the hood,
it's really pretty straightforward.
We've got a a lerp, a linear interpolation
and it's going from a black,
which is just three values, 000, and white, 111
based off of an input amount that's coming in
from the outside, and this being output as a compound.
We can go back over to our flow.
We can see that we've got that guy there,
but now we need to do something with this
black to white information.
We wanna shove it into the vertices.
So let's pull in another node.
We'll do color vertices.
And we are almost there.
So we're gonna use this function
and drive this color vertices so for every vertex
in our mesh we are going to
then color the vertices.
And the output is going to go into that mesh.
We also need to know, hey, what mesh is it
that we're working on so we need another input.
I'll do a modifier tri-mesh.
And that's it.
So at this point we can go ahead and save this guy.
I've already got a test version going here.
And we can evaluate that and
let's get rid of the one that's existing on there
and go to our new version.
So we've got this MCG color by distance test,
very creative name.
Pick our node, give it a certain amount of
falloff here, okay.
See that we've got some mount
and, as expected, it works.
So hopefully that gives ya a little bit of an idea
of an existing flow, kind of building it up from scratch.
I think it's a really great idea to,
to take some of the example flows
that you see and dig into them,
try to figure out what's going on under the hood,
and then as practice, you know,
rebuild that from scratch,
figure out what ya understand about it,
what things you might not understand.
It's a really good way to start getting up to speed
on what the MCG can do.
So, thanks so much, will talk to you soon.
(light music)