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

Friday, October 11, 2013

MARI: A walk on the wild side - stylized texture painting

I think the one tool, that made Mari what it is to texture painters today, is the Paint Through tool. Secondly, you could mention the ability to handle hitherto impossibly large amounts of image data with ease. Seldomly does the basic Paint tool get to be front and centre to what we do as texture artists. I call myself a Texture Painter. I paint in my spare time. Oh yes. Brushes, canvas and paint in tubes. No school, like the old school. But that has little to do with 98% of the work you can find today as a texture artist. Sadly.

Recently I was approached to paint textures on an animated short celebrating KFC's 40 year anniversary on Trinidad & Tobago. Yes, paint textures. Not project photos. Being a huge fan of stylized cartoon animation, I leapt at the chance. For this particular project Producer Nicholas Maxwell and Director Adrian Nurse wanted something stylized and painterly with visible brush strokes. A point of reference was the excellent Meet Buck by the Steak Kollective.


Analyzing the look of Meet Buck a few things stood out. Comparing the two projects, we were not going to have exactly the same lighting setup, but in terms of textures there were a couple of things we could run with; I deduced the following basic rules, which served as a guide to unify the look of the textures in our short:

  • First pick a base colour - the local colour of the object
  • Take that base colour and change it into two variations: One slightly lighter and one slightly darker - both with a slight change in hue as well. These two will serve to break up the base colour, add visual interest and take it towards that painterly look. To that end, it is important that these two colours are so different (both in terms of hue and value) that the brush strokes can be seen, but not so different that the brush strokes will appear noisy or jarring.
  • Use a brush on reduced opacity, in order to build up your brush strokes as you go. This allows you to get a lot of mileage out of the relatively few colours you work with. (My go-to brush was basically feltTip from the basic brushes tab set on 0.350 opacity.) By mileage I mean that instead of adding the necessary variations in colour and value to your textures, which is needed to add richness to that organic painterly look, by picking umpteen different colours to paint with, adding brush strokes on top of brush strokes for different combinations of opacity, will give you those levels of variation you need.
  • We needed to paint a fair bit of light and shade into the textures. Working again from the base colour you pick a colour of a slightly different hue and a good bit lighter or darker. These are used to paint in light and shade, as well as in places help shape the model by suggesting details in the geometry.
  • In addition to this, on the face of hero characters you want to add the classic golden (from forehead down to eyebrows), red (from eyebrows to tip of the nose) and blue (from bottom of the nose to the chin) zones of the face.  
  • Finally, as this animation would include the actual likeness of the KFC founder Colonel Harland Sanders, we couldn't quite push the style as far as Meet Buck. 
Repeating these five steps created a tight recipe, where assets could be turned around fast and with a uniform look.

This little story consists of a young boy and his father over the course of the 40 years KFC has existed on Trinidad & Tobago. They grow and age together, with local historic events from the past 40 years in Trinidad & Tobago as backdrop. The animated short was split into a 15 seconds teaser and a 45 seconds full short.

Before we dive into how the individual textures were made, I have to give credit to all the rest of the team, from the brilliant backgrounds from Victor Georgiev, and the animators breathing life into the characters, to the lighting and shading by Vanessa Thieffry and the compositing by Adrian Nurse.

Since this is a story about fried chicken, let's start with a drumstick prop. Sharing my work in progress with another long-time texture artist we marvelled at the opportunity to paint a piece of fried chicken; Doesn't happen every day. Or ever, to most texture artists.

So you start by blocking out the colour of the drumstick. This colour was sampled from a photo reference of a fried piece of chicken. Simple.

Then you bring in a darker variation of your base colour and add some variations to the base. At first you literally just lay down random brush strokes to break up the base. Once the first few brush strokes have been put down, you can do more conscious ones. It may not look like much so far, but keep the faith and follow the recipe and we'll get there.
Then you add a colour lighter than the base, again for variation, and again your first strokes will be randomly placed. There are no blend modes or opacity changes involved. Just each colour on a separate layer and lower opacity (between 0.2 and 0.3) on your brush.
Now we have a nicely varied base. Time to help shape the drumstick a bit. For clarity, this is the mesh with full lighting:
First you pick a lighter colour and paint in the peaks of the geometry:
Then all that is needed to finish up is a darker colour to paint in the recesses of the drumstick.
Finished... One piece of crispy fried stylized chicken. Enjoy!

To recap, please note that I have changed the hue of the colours I work with on each layer. That as well as the lower opacity brush, I think are the key parts to building that variety which is needed to sell a painterly look.

Let's try this on for size on a character. Here is the mesh of the (youngest version of the) father character:


So you start by blocking in the colours (please excuse the intersecting mesh in the eyebrows):
Then we add lighter brush strokes to break up the base. Notice again their fairly random placement.
Similarly with darker brush strokes. Here I have in places used the darker brush strokes to shape the model a bit.
Adding in stripes to the shirt (a basic HSV adjustment layer with a mask, shifting both hue, value and saturation to fit) and stitches to the jeans (simple paintable layer with no blend mode nor opacity changes).
Next I am adding blue colour variation to the "blue" portion of the face (see above). This layer is set to 0.100 opacity, but still normal blend mode.
Similarly adding red colour variation. This layer is set to 0.150 opacity and Overlay blend mode.
Finally the golden colour variation on a layer with Overlay blend mode and 0.300 opacity.
Before I continued with my formula, I needed to add a bit of detailing to the lips:
Then we start shaping the model with the painted light.
And similarly with painted darkness.
At this point I wanted to bring the lips out a bit more. So an HSV adjustment layer with a layer mask did the trick.
Finally a touch of Ambient Occlusion to help further bring out the shape of the model.
At this point the client asked for changes in the value of the father's skin tone, so the final textures ended up like this:
And here is the father in all his lit, rendered and composited glory:


By far the hardest asset to get right, was also the most important: Colonel Harland Sanders from KFC. It was daunting to get his likeness right, but at the same time keeping him true to the art style of the rest of the film. Regardless, I set out determined to see how far my "recipe" could take me with the Colonel.

I was helped greatly by the model (please excuse the intersecting polygons in various places). Already a good likeness was there:
So I blocked in the colours. How do you paint a white shirt inside a white suit? Pure white is of course anathema to texture artists. I decided on playing with very light pinks, blue and crèmes to create the illusion of the white suit.
For this model, I thought I would need some additional colour variation in his skin. Please again note the seemingly random brush strokes. Yes, there is such a thing as 'happy mistakes'!

Then comes the light brush strokes for variation of the base colour.

And the dark ones...
Then I begin to shape the colours of his face. First I add blue from beneath the tip of his nose down to his chin. This layer is Overlay blend mode with 0.150 opacity. Easy does it; we only need a hint of blue.
Next is a bit red across his cheeks, nose and ears where you have a lot of blood vessels close to the skin. I am using Soft Light and 0.250 opacity on this layer.
And finally a touch of gold across his forehead. Overlay with 0.200 opacity.
In my reference photos of the Colonel, I noticed that he had a fair bit of pink across his cheeks and nose, as older white people often do. To wit, I added a layer with some extra pink goodness for the Colonel. This sits on a normal paintable layer with no changes to blend mode nor opacity.
Now it is time to separate the men from the boys. Painting light into the textures will very much determine whether the final textures will look like the Colonel or just some overworked mess.
Similarly the painting in shade very much brings out the features of the Colonel. It was a fine line to not overdo the dark lines - on one hand he needed to look like the aging Colonel, on the other hand he could quickly start looking like a bad rubber Halloween mask.
Finally a touch (0.200 opacity with Multiply blend mode) of Ambient Occlusion to round him off and tie everything nicely together.
Here is the Colonel with the concept art and reference photos I used.

And in all his rendered glory...
All told, I am pretty happy with the outcome. Any texture painting geeks who want to inspect the flats? Okay then. Here is the Colonel's face:
and his trousers, shoes and hair:
You can view the 15 second teaser here.

When we started on this project, I had some doubts whether Mari would be the best suited tool for a job like this. I knew that the Steak Kollective guys had used Photoshop for the textures for Meet Buck. I have always admired the very painterly output you can get from Painter, with its excellent ability to mimic real world art materials and surfaces. However Mari was more than up for the task. Mari was clearly created for VFX use, but in my opinion its toolset goes much further than that.






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.

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.