This blog describes my journey exploring storytelling - words, images and the sensations they generate. The lot, basically.

Wednesday, October 09, 2013

MARI: Distressed painted metal texture from scratch - Part 1

"Start with what is known, and what is hidden will be revealed."  - Rembrandt van Rijn


That right there, is pretty much my artistic modus operandi. You may not know all the steps needed to achieve a finished look, or indeed very many of them, but start with what you know, and what is still needed, will become clearer and clearer as you go. 

Pretty much what the flexibility of a layer system allows us to do - adding in different ingredients in various amounts till you have the desired look.

Mari started out with a "layers" style system back in the day, where layers were called "channels", but still had blend modes, opacity and masking options, just as we know layers originally from Photoshop (Layers were introduced in 1994 in Photoshop 3.0). From Mari 2.0 and onwards layers are indeed called layers, and channels now refer to something different. My example file here was originally made with Mari 1.5, so please excuse the slightly different interface. The layer system in Mari 2.0 now more than matches what Photoshop can offer on that feature - particularly for texture painters! Layers in Mari now is chokeful of goodness like procedurals, adjustments of all kinds and masks, which can be small layer stacks themselves. Add to that one of my favourite features: Advanced Blend Modes!

But for this demonstration, the basic functionality of the layers setup will do sufficiently.

The subject here is an old jerrycan. This gives us the distinctively differement materials painted metal and a rubber hose to play with. I found it modelled and UV'ed nicely on CGTrader. Go grab your own if you want to follow along in this little paint by numbers session.


When I am painting hardsurface textures, I know there are a lot of material properties which will be common to most objects. Obviously there will be a surface colour (maybe it is a paint layer); maybe some of that will have been scratched off to reveal the material underneath (in this case a metal like aluminum or steel); If the paint has been in contact with strong sunlight, it will be bleached and lose saturation and increase in value; The paint can have been applied unevenly, resulting in differences and small details in the paint layer; Depending on the type of object, it can have any number of different types of stains; Ordinary dirt will gather in corners, scratches and other places; Dust will also gather where the object is not regularly touched, and in places where it will stick to a liquid for example.

This is by no means an exhaustive list, but as you consider an object, think carefully about how it has been made, how it is being used, where it lives and what substances it gets in touch with on a regular basis - and how each of those affect its colour, shine, bumpiness and other attributes. I literally write down a list of attributes and cross them off as I go. If I am at a loss to where to take an asset, when I start, when I have ticked off all of the attributes on my list, I will either be finished or have a very, very good idea of what last few steps are needed to take me home. Which is basically what the Rembrandt quote above means.

As this is a wellworn painted jerrycan, we'll start with an aluminum base. I used this aluminum base texture from CGTextures:


This particular aluminum texture deserves some kind of Most Valuable Player award. I have come across it in many, many texture artists' Image Manager. Even if it doesn't tile, it a very useful image. It has enough details to make it interesting and not enough strong details to make it jarring. As it is a white metal, it can be used as a base for a lot of different metals. And finally it resides on the very popular site CGTextures.

So my bottommost layer consists of this aluminum base. In UV view I did a quick Paint Through job with Repeat turned on to cover the entire object. Then I painted out the seams in Ortho view - also using the Paint Through tool and our chosen aluminum texture. So far, so good:

Next we need some paint on our model. Add a procedural layer with a Color Constant. Pick a suitable colour for your paint (I went with an olive drab green). A word of caution here: In our minds colours are always more saturated than they actually are. You may think that a fire engine is perfectly red, with 100% saturation. I dare you, grab a photo of such a fire engine and sample the colour with your Color Picker. See? Not even close.

Right click on your layer and add a Layer Mask for the selected layer, which you set to Reveal All. Now with the Layer Mask selected still, choose the Paint tool, set your paint colour to black and pick a suitably organic brush to paint scratches with. You want to paint in all the places where the paint has worn off the can (as well as the rubber hose, where no paint should be found). Picking a suitable brush - or combinations of brushes - is half the work. To help you get that flaky look of peeling paint, you could enlist the services of the brilliant Fractal Noise Mask. Find it under the Projection palette. First tick Mask Preview Enabled in Projection Settings, so you can see what your settings will look like before you start painting. 


Then turn on Fractal Noise Mask a bit further down, crank the Mask Amount up to 1.0 and set the size to something suitably small like 0.059 or smaller still. Feel free to play with the Roughness and the other settings till you have a look you like.

When you now start painting in the places where the paint has been worn off, please consider the use and shape of the jerrycan: Where will it be worn the most? Feel free to carefully study old jerrycans with a Google image search. Here is my can. Maybe a tad overdone in places.


But green paint doesn't stay exactly the same shade of green for very long. We need to get some different details into the green paint to make it more believable; Break it up and create some variation.  So pick the colour of your paint and change its value and saturation a bit. Grab your Paint tool and pick a good broken up and organic brush. I used primarily the Iguanadon brush (under Brad's New Brushes when you hit K). But you want to use a few different brushes at reduced opacities to make sure we don't get too obvious patterns. This is what I have (flat lighting):

 And with full lighting:
I should mention that when I painted this in Mari 1.5, I used the Layer Mask controlling where the green paint goes to also control what parts could have the added green paint variation, by inverting it. With Mari 2.0 (and beyond) a much more elegant and neat way of doing all of that is to place these two green paint layers in a Group and then put the Layer Mask on the Group. That Layer Mask is the one where you paint in where the paint has chipped off the jerrycan.

While we are still detailing the paint work of the jerrycan, why not paint in a decal to both give it some visual interest and further tell the story that this is a military object. I prepared a few stencil style decals in another paint package:
Notice the blurred edges. If these stencils are being sprayed on in a quick and dirty fashion, no way would that spray paint be sharp and crisp on the edges.

Stamping the decal images with the Paint Through tool onto a layer above the green paint layers is very simple. But as a former Lead of mine always used to say, 'you have to work in your brush strokes!' What that means is, it would ruin the illusion if we just let these stencils sit undisturbed on top of the paint layers. That layer of spray paint would start getting worn away very quickly - if it even was 100% opacity to begin with. So use the Paint tool, set the Painting Mode to Clear (or if you want the gold star for non-destructive workflow do so by giving the Layer a Layer Mask and painting into that with black) and pick a soft brush with low opacity. Here are my decals after a little bit of work (in flat lighting and on a 50% grey background for clarity):


All told, that takes our layer stack up to something like this:
My next layer contains a mild bit of Ambient Occlusion (AO). This I use to simulate the dirt which imperceptibly will gather in cracks and corners on an object like this. I don't expect a jerrycan would be treated with much care and attention. If used for gasoline or oil it would probably never be washed carefully. So dirt will gather in cracks, where the general actions of use and wear will not remove it. 

Generally, you want to be careful with Ambient Occlusion in your textures, as it bakes in lighting information into the textures - which really should be the domain of the shader and lighting to add such details. But in reality, you do find a small number of instances where texture artists (and lighters for that matter) talk about "helping the shader along" with things like Ambient Occlusion and painting lighter edges on assets for example. But perhaps that is a topic for a different day. For now, let's just state that Ambient Occlusion rendered out as masks can be massively helpful for a number of things.

To generate Ambient Occlusion for use in your textures, select your object (if you don't already have it selected), go to the Objects menu and select Ambient Occlusion. This will get Mari to start calculating the Ambient Occlusion. Then add a procedural layer (Geometry - Ambient Occlusion) and change the blend mode to Multiply and opacity to something like 0.350. If you want a gold star, throw on a Layer Mask and break up the AO to add variety.

This is what my layer stack looks like so far (with flat lighting):

And with full lighting:
Before we go any further with the can itselft, we really need to do give the rubber hose some care and attention. Select the rubber hose part of the jerrycan with your Select tool set to Faces (you can use Smart Selection Mode if you like, but due to the way this model has its UVs laid out, you will not get all of the faces in one go). Add another layer for the base of the rubber hose. Fill that layer with a dark grey (You never want to use complete black nor complete white, as they mess up shader math. I am no shader mathematician, but think about it, how do you multiply with either 0 or 1 - if the range of the possible results can only be between 0 and 1? Those values are no good.). I used 0.234 0.228 0.215 (RGB values):

Too flat. We need some detail in there. Pick a lighter colour (I used 0.153 0.156 0.157 in RGB values), and with your Paint tool and a nice broken up brush (could be crackSplat from the Hard Surface Brushes tab) set on low opacity (0.3 or there abouts) add in some variation to our rubber base. The aim is variation in the colour along the lines of a mottled pattern:

Better. Now let's use the wonderfully organic pattern of the aluminum base underneath. Change the blend mode of your rubber base layer to Multiply. Okay, that is looking decidedly a lot more like a black rubber hose:

But we can do better still. We need more detail to sell the look of rubber. Add another layer to sit above the rubber base. Grab yourself a concrete texture from CGTextures or Texture Pilot. Then using the Paint Through tool and a broken up brush (like crackSplat) to paint some of the concrete onto your layer like this:
Now change the blend mode of your rubber details layer to Color Dodge and the opacity to something around 0.537. This is what my stack looks like so far:
That will do as a nice rubber base for now.

Remember that nice concrete texture from before? We need to employ that again to add some general dirt to our jerrycan. Add another layer and set the blend mode to Overlay and the opacity to something in the vicinity of 0.266 (these values are not set in stone, so feel free to play around with them, to match the concrete texture you are using and the look you are going for.). Now using the Paint Through tool and a brush like Linear (found under the Basic Brushes tab when you hit the hotkey K) use your concrete texture to paint more varied and detailed dirt onto your can. I should point out, as a matter of course, that you want to have your Edge Mask switched on, to avoid streaky paint on your edges (find it in your Projection palette):


This is what I have so far:


 
A little bit of dirty details, which sits nicely on top of the paint and decal layers.

This jerrycan is meant to have taken a fair bit of abuse. Metal like aluminum naturally gets scratched under such circumstances - particularly on the edges and corners of the object. Hunt down a couple of suitable metal scratch textures. This is what I used:

Adding a new layer on top of your layer stack, use the Paint Through tool to paint these beautiful scratches onto the edges of the model. Something along these lines (here set against a 50% grey background for the sake of clarity):
If we then change the blend mode of the Layer to Hard Light and lower the opacity to around 0.8 (I used 0.798 to be precise - but again that depends on the texture photos you have at your disposal and the look you want), the jerrycan should look like this:
So... how about all those exposed areas of metal? They would rust over time. We need some rust to add to the beauty of this object. Find yourself some suitable images to sample rust from. Here are mine:

Add a layer for your rust and give it a Layer Mask (set to Reveal All for now). Using the Paint Through tool paint the rust onto your can where the paint is peeled back and has exposed the metal underneath. You are only as good as your reference, so do have a look at how and where rust gathers on similar objects.
Should you wish to, you can paint into the Layer Mask to help fine tune the speckled look of rust. Finally, change the blend mode of your rust layer to Multiply, and you should have something looking along these lines:

What other details do we need? If this can is used for gasoline, it would be reasonable to imagine that some of the gasoline would spill and drip onto the can from time to time. Such a stain would again attract dust and other dirt, which would stick to the gasoline drips. Let's try and create a stain like that.

Add another layer for our spills. Find a suitable texture with streaky stains on. This is what I used:
 Nice organic streak details with variety in colour and value.

Using the Paint Through tool, paint in nice long streaks starting from where the rubber hose is attached to the spout. Change the blend mode of the layer to Vivid Light and your opacity to something that suits the spill texture. I have used an opacity of 0.552 in this image: 
Remember I mentioned that AO rendered out can be used advantageously for various masks? Now I want to add a subtle layer of dust to our can. For that I will need our AO inverted. Add a Group Layer. You could name the group Dust for example. Add another Group Layer and drag it inside the Dust group. This new Group you could name Dust_broad. Add an ordinary paint layer and drag it into the Dust_broad Group. Select the Dust Group and add a Layer Mask. Right click on the little Layer Mask icon (which should be glowing orange) find the Make Mask Stack command. This will change our little orange friend from a sphere inside of a square to three horizontal lines sitting in a neat little stack. If you again click that new icon, it will open up a palette with the mask as a layer stack. In that palette add a procedural layer (Geometry - Ambient Occlusion). If you have already calculated the AO, by selecting your model and then selecting Ambient Occlusion from the Objects menu, then you can skip this step. On top of the procedural AO layer, add an Adjustment Layer - Invert. Now we have a inverted AO as a mask. This specifically means that we have a mask, which will allow us to paint only in the crevices of the model. Exactly the place where dust collects over time. So pick a dust colour. I used a grey brown (RGB: 0.371 0.328 0.276). Select the Paint tool and pick a broken up brush like crackSplat or oldShipyard (under the Brad's New Brushes tab) and start painting in dust on your paint layer inside the Dust_broad group. With the help of the layer mask, you should have something like this:
If you change the blend mode of your Dust group to Overlay and the opacity of the Dust_broad group to around 0.570, you should have something like this:
So much for general dust. I still want to add some more specific dust where I know it would gather particularly: Inside the nooks and crannies in the handle, around the edge of the spout and the cross indentation on the side of the can for example. So add another paintable layer and another group layer. Rename the group layer to Dust_detail. Drag the paintable layer inside the Dust_detail group, and again drag the Dust_detail group inside the Dust group. Pick a dusty colour.
Grab your Paint tool and one of the broken up brushes I suggested before, lower the opacity of the brush to around 0.500 and start painting. Here is my dust layer:

I want to give it a slightly grainier look. I could have employed the Fractal Noise Mask set on a really small size for this, but instead I am going to use a filter. Filters menu - Add Noise. Don't tick the Grayscale box - we don't mind the extra bits of colour variation. Set the size to something suitably small like so:
 

Apply that filter to your Current Paint Target (which should be the dust layer you have selected). You should have something looking like this:
We are about done here. I still think that this beat up jerrycan could do with a bit more grime to match the level of abuse it has suffered in general. I think the green paint is still too even. Apart from the colour differences we put in earlier, paint will assimilate stains over time, which will bleed into the paint, changing the colour, value and saturation. I used this texture to add grime:
Add another paintable layer to your stack, add a group layer and drag your paintable layer into the group. We could rename this group to something like Grime. Roll out the trusty Paint Through tool. Cover your model with the texture, keeping in mind the size of the details relative to the size of the object. This is what my grime layer looked like:
Gold star for adding variety to the grime layer by a layer mask and painting a bit of variation opacity wise. In general I am happy with this layer. Only I wanted to take a bit of saturation out of the grime, so in my Grime Group, I have added an Adjustment Layer (HSV), which allows me to turn the saturation down a bit. Changing the blend mode of the Grime group to Overlay and the opacity to 0.650 gives us something like this:
Duly rendered out the jerrycan looks like this:
Naturally we still need to create a bump map and a spec map, but these secondary maps will be the topic for another post.

At the end of any project, it is worthwhile to look back and go over the steps you took. There is still a lot of things you could add to, or subtract from this colour map. Personally, I think I could have been more subtle with the peeled off paint; The green paint is maybe a tad oversaturated in places etc.

There are no revolutionary new techniques in this workflow; This is a pretty standard and straight forward bread and butter approach for a texture artist. But in order to return to Rembrandt, the powerful and flexible layer system of Mari, allows us to keep adding in details until everything has been revealed.

This tutorial continues with a look creating spec maps for our jerry can here.

Did you find this useful? Leave me a comment, share the post via your favourite social media or drop me an email about things you'd like to see covered.

Saturday, September 21, 2013

MARI: Removing strong details in tiled base textures

When you put together a base texture, you want it to be a good neutral representation of the given surface, perhaps even with a bit of interesting details. 

But those details are a double edged sword, as they will also quickly show up as repeating patterns - giving away that this is not a custom painted texture, but a tiled texture.

What to do? 

You could just manually cover your object with the Paint Through tool, using only the more neutral parts of your base texture map. 

I like to keep things procedural as far as I can - it just gives way more flexibility for fast and painless editing and changes down the line. Also it can be a lot quickler to work this way. Let me show you a couple of nifty things you can do with MARI's 2.0 layers:

Enter our base texture, which has been tiled 15 times in both directions.

That gives us something looking like this:



A nice place to start for a copper object. However, it does have some pretty conspicuous black details. We need to remove a few of them to make sure the texture is not appearing so obviously repeating.

There are a couple of simple things we can do, before we have to dive into the nitty-gritty of carefully painting each one out.

Add another layer with our tiled copper texture, this time tiling it and rotating it differently (this one is set to 12 times repeats in both directions). This is to make sure that although it is the same texture, it will not sit exactly the same place on top of the other one.



Right click on the layer and add a Layer Mask for the layer. Set this one to Hide All. 

Having selected the Layer Mask (it should still be selected after you have added it, but if you have since clicked on other layers etc. it might have become unselected. If so click on it to select it, and it will glow orange, like in the photo) for your new tiled texture, select the Paint tool, pick a brush with soft edges, like Linear, and choose bright white as the colour to paint with.

So far we can not see the layer with the new tiled copper texture. But by painting on the layer mask, for that layer, with white, we will reveal the additional copper texture, where we want it to cover the black details in the layer below. The idea here is that, as we have changed the tiling and rotation of the same texture, we might use different parts of the texture to cover the areas of it, that we don't want.

In that way we can get rid of some of the black details, we don't want.


However, you are of course at the mercy of whether or not there will be a suitably neutral patch in the texture in the layer above to cover where there are disturbing details. This may, or may not be the case.

So what else can we do? 

Add another procedural layer on top, this time a Color Constant. Using the Color Picker, sample a representative neutral copper colour and set the colour of the Color layer to that.


Change blend mode to Lighten, and then the layer will only cover pixels darker than the neutral copper colour you have selected for it. It might bleed out too much the details of the copper base texture underneath so experiment with opacity till you have something that works.

Now we have taken those big black details in the texture down to a manageable level:

 


Let us just go through a variation here.




The above copper texture was a base and as such used the Normal blend mode. What if you use other blend modes which affect the layers below them? Then we need to change the approach slightly.




Here is a nice noisy texture that I am using as an Overlay to add details to my layers below it.


The problem is, if you have an Overlay layer and you are painting out details using another layer above it, also set to Overlay, you will get really dark patches where you mask in details from the layer above. Like this...




Fortunately MARI's new layer groups come to the rescue here. You add a group, place the two tiled textures inside the group - each set with Normal blend mode - and then let the Group have the work of carrying out the Overlay blend mode. Like so:




Result:


Pretty good, and definitely very quickly and easily. What about picking a neutral middle colour like we did before? Okay, but let's take it up a notch.

So we pick a neutral colour, and add that as a new procedural Color Constant layer. 

Set the blend mode of the layer to Lighten and experiment a bit with the opacity. This will cover everything darker than the colour we have picked for our procedural layer. This approach can be a bit heavy handed, and produce great areas now coloured with our chosen colour. You can lose a lot of interesting detail this way.

I have anxiously been waiting for the day when The Foundry will allow me to select colours, the same way I am able to do so in Photoshop.

This brings us to one of my absolute favourites of the many new features in MARI 2.0: Advanced Blend Modes!


No fear. This is not exactly selecting colours in a layer, like you would in Photoshop, but it allows me to affect particular colours just as if I had.


Notice the little green triangle next to your opacity slider (marked with a red rectangle below)? Go on click it. It will open the Aladdin's cave that Advanced Blend modes truly are.




First you need to change Blending from Basic to Advanced. Doing so gives you access to the Curves style controls for both your selected layer and the layer below it. In this case we only really want to affect the black spots in the layer below, so manipulating the curves for that layer (marked by the green rectangle) we pick what values of the layer below we want to affect with our Color Constant - in this case the darker values. 


The results are absolutely wonderful!


Smooth as a baby's... something. Oh MARI, how I love you. Let me count the ways!


Did you find this useful? Leave me a comment, share the post via your favourite social media or drop me an email about things you'd like to see covered.