Tip:
Highlight text to annotate it
X
>> Earlier we talked about a couple of attributes
of our texture files called the color gain and the color offset.
Those are in the same position as the default color
that we used with the star field.
So let's take a look at those.
I'm going to select my flag here,
and come up to my work area and right click
and say Graph Materials on Selected Objects.
And this is going to show me my rather complex looking
Shader Tree.
It's not as complex as you think when you start breaking it down.
This is my shading engine, which feeds into the light linker
and the render partition.
Let's pull this apart a little bit.
This little section right here is my displacement map,
and if you recall, we fed that directly into the shading group.
Also feeding into the shading group is the surface.
Remember we discussed that the shading group node is
where the associations are made between the displacement,
the object, and the color.
This right here is all of our bump information.
And remember we just chain-linked three bump maps,
so each one has a set of three values here.
And then this is the color.
So when you simplify it like this,
it can make a little bit more sense.
So what I would like to do right now is work on a dirt map,
and in order to do this, what I want to do is map that dirt map
to my file texture right here.
In the color balance section, we have the default color,
and we define that as whatever is underneath a texture map,
when the texture map doesn't cover the whole surface,
so in that case it was the star field.
Then we have the color gain and the color offset.
The color gain is a multiplier, so any of the values
of the texture map get multiplied
by the value of the color gain.
And here's where you're going to have to start thinking
about these as numbers.
The formula, the RGB formula for white is 111.
So any color values multiplied by white is the equivalent
of multiplying them by 1.
And anything multiplied by 1 is always itself.
So the color gain is set at white because it wants
to leave these colors alone.
If I darken this, every one of these colors is going
to be darkened by whatever that value is, and you can see
that since I'm dealing with my star field here,
by multiplying this by a gray or a black,
I'm actually darkening the star field.
If I put a value in here, a color value, and I multiply it
by something like pink, you can see that all
of these values are multiplied by this pink.
The color offset on the other hand, is an additive value.
Gain is multiply, offset is add.
So by adding black to anything like this,
it's not like adding black pigment on a painter's pallet.
Black is the equivalent of 0.
So when we add 0 to anything, we end up with itself.
If I add color to this, we're going to end up brightening it
or just desaturating the colors.
So the same will happen with this ramp right here.
Any of these textures have a color balance section.
And in this case, the color gain is white.
We can multiply that down.
We could darken the whole stripe.
So that's the basic concept behind what we want to do.
In order to create this dirt map,
I'm going to create a fractal texture and multiply it
by my existing texture.
So by doing this, I'm going to spread out a kind
of random pattern of black and white.
Any areas that are multiplied by the white, of course,
will be left alone and any areas that are multiplied
by the darker gray or black are going
to appear like they have dirt.
So let's get started.
The first thing that I want to do is I want
to just create this fractal texture and make it look right.
So, in order to do that, I like to simplify things.
So I'm going to select my blend material,
and in my edit menu here, I'm going to click
on duplicate without the network.
So what that's going to do is create a standalone blend
material, and the color, I'm not sure why this comes out as blue.
I'm going to change it anyway,
but this has the same eccentricity
and specular roll-off as my original blend,
without the color or the bump.
So I'm going to go ahead and assign that to my flag,
and change the color to white.
So this way I can experiment with my fractal,
and I can see the distribution
of the values along a plain white surface.
And then once I get it the way I like it, I can re-assign it
to the original blend.
So let's just take a look at the input and output connections
of my blend here, and I'll take a fractal material,
or fractal texture, and I will assign
that to the color attribute of my blend.
So this is obviously not a very good dirt map.
I'm going to have to adjust some of the parameters.
So let's take a look at the input and output
of the fractal material.
So I have several options.
And these are things that you really need to just experiment
with so that you can see what they do.
What I'm going to do here is go into the placement note
and I'm going to take the repeat in U and V, and turn those
down to very small numbers.
So let's try .01 in U and .025 in V. You can see how
that spreads this out.
So let's try a little bit smaller.
Let's go to .005 in U and .01 in V, and you can start to see
that I've got larger areas of white, and so it's not
as evenly distributed as before.
I'm going to start out with something like that,
and we'll see what we can do.
So going now to the fractal texture itself,
I want to take a look at some of these attributes,
and really the best way to learn about these is
to just experiment with them and see what they do.
Every texture has its own set of unique attributes,
so for me what I'm going
to do is increase my threshold a little bit and that's going
to make that a little bit wider.
I'll increase my ratio of darks to whites, and you can start
to see now that this is starting to get pretty rough.
Let's just do an IPR render here so we can keep an eye
on what's going on here.
All right.
So now we're starting to get some splotchiness,
some real good contrast between the dark and the light.
We can play around a little bit with the levels.
The minimum level doesn't seem to be doing very much.
The maximum level splotches it up a little bit more.
So you can see how this is starting
to affect this fractal texture.
So the bias is going to lift all those values
up closer towards 1, and so here we can play around with this,
and maybe get a pretty interesting looking dirt map.
We can control how this gets placed.
We can rotate this frame here a little bit,
so we can make different areas, dark and light.
We can't be very specific about how this gets dirty.
If we wanted to do that, we'd have to paint our own dirt map.
But this, I think, will do pretty nicely for our flag.
So I've got this fractal number 2 already set.
So let's see what it looks like when we use it
on our shading network.
I'm going to find this blend here.
I'll look at the input and output connections.
And I'll assign the blend material to this flag,
and now we can see we've got what we had before.
I'll go back into my split screen view, come over here
to textures, and my fractal 2 is right here.
So I'll bring that down and go back into my work area.
Looking only then at the color map section, which is here,
and I'll shift and select my fractal, and I'll show the input
and output connections.
So here's my color map right here
and here's my fractal right here.
Okay? So I don't need this blend 4 anymore.
That was just my test.
But what I want to do is multiply both my file texture
and my ramp by this fractal
because of the placement of each of these.
So let's start with the file texture.
I'll drag and drop, and in this little menu here,
I can add this texture right to the color gain attribute.
And that's going to darken this area right here.
Then I'll do the same thing - actually,
I'll do this a little bit differently.
You can do it either way, but I want to select the ramps just
to show that you can do it.
I'll drive the fractal over here to the color gain.
And now you can see that I'm starting to get that dirt.
And what's happening here is that the values,
like I said before, the values of the red and white stripes,
and the values of the blue and white star field,
are being multiplied by the black
and white pattern of the fractal here.
One of the downsides of using it like this is
that I can't really get any color in the dirt.
It's going to just be a darker version
of what I have underneath.
One thing that you can do with this fractal is
down at the bottom here, under my section,
I can do a color remap.
And when I do a color remap,
what that does is it replaces my black and white values here.
Let's just look at my output connections to get
that a little straighter.
So what it does is it puts an intermediary utility note
in here, and essentially just remaps the grayscale values
to the values of a ramp.
The way it works is that a size 0 to the bottom of the ramp
and a 1 to the top, and creates an even distribution
of decimal values in between.
The grayscale values of our fractal fall
within a 0 to 1 range.
So the remap just makes a direct replacement of each value
with the associated colors of the ramp.
Wherever the fractal is black, or 0, that value is replaced
by the bottom of our ramp.
Wherever it's 1 or white, the value is replaced by the top,
and the in-between values fall into place accordingly.
Here I've replaced the top of the ramp with white,
so the end result is that our flag would be multiplied
by white, or 1, resulting in no dirt at all.
When I change this green to a brownish hue, the gray areas
of our fractal pattern will be replaced by the range of brown
in our ramp, and will then multiply, or tint,
our flag values to that brown, instead of just darkening them.
So you can get the pattern that you like for your dirt
by using a fractal texture.
And just as long as you understand
that the fractal is really kind
of a mathematically contrived randomness, and you can't put,
well you probably could figure it out,
but it would be very difficult
to get specific areas of dirt on here.
By remapping the fractal using the color remap function,
you can remap the values to a ramp,
and you can color the grayscale values.
If you want to have a very specific kind of color map,
you'd probably need to either paint or photograph the kind
of dirt that you're looking for.
So I've gone ahead and done that.
To get started, I'm going to disconnect this fractal
and remap from my shading network.
I don't really want to delete it because I may want
to come back and use it later.
So in my 2D textures, I can create a file texture
and what this does, just sort of like we learned
in the star field, is it's a repository for an outside file.
I've gone ahead and created a dirty linen picture,
and this is just a photograph of some dirt.
So I'll just open that up and then I can take this one
and map it to the color gain and color gain of my two textures.
And you can see that that's going
to give me a little bit different distribution
of this dirt.
It's more photographic and you can be a little bit more
specific about where you want the dirty parts to be.
There are a few other things that I can do
with the dirt map here.
I may decide that I want to combine both my remap ramp
and my file texture to make one combined dirt map.
And I can actually do that.
Let's disconnect this.
I have both of my maps here,
and what I can do is combine them using the utility node.
The utility node that I want to use is called the blend colors,
and if you look over here in the attribute editor,
it has three attributes.
It has a color 1, which is an input, a color 2,
which is another input, and then a blender, which is a slider
that will bias this image towards color 1 or color 2.
So it doesn't really combine the two at 100%,
more it balances the two.
So I'll bring my file one to color 1, and my remap ramp
to color 2, and then I'll bring this in and I will map
that to the color gain of my two color maps.
And now I'm getting a blend of both the photograph
and the mathematic dirt map.
So I can bias this, blend it entirely
over towards the fractal side, or I can bias it
and bring it right over to the blend side.
In the same way that you can chain-link your bump maps,
you can chain-link your blend colors maps by mapping a color
to file 1, and then another blend colors to file 2,
and then another one, and another one, and another one,
so you can have several blend colors maps,
each one using another blend colors as the second input.