Car Paint - Part 3

Car Paint Tutorial - Part 3 (Flake Mask)




The flake mask is the most simple component of this system. Although, discovering this technique took a lot longer than you might think. Originally I was creating a system which was over elaborate, always easy to do in our profession. But after a lot of tinkering, I was able to condense it into its essential parts.

First thing we need is a texture to drive the mask. The texture we will be using is named Noise4. One of the secrets of why my shader works is due to the seemingly random texture. It was created in photoshop using the noise method, and then gradually decreasing the number of single pixels. It is not necessary to have such a large texture file to drive the flakes, but it does help lessen the effect of texture repeating.

We are going to want control over the Scale of these flakes. Like before, we need to create a UV coordinate node and multiply it by a “scalarParamter.” Name your  “scalarParamter” something like “Flake_Scale” and plug the multiply into the UVs of Noise4. Set Flake_Scale default to 12.   

The last aspect of flakes we want control over is the size of the flakes. Relative size, that is. How large the flakes are in the standard density. We can do this easily by creating another multiply and scalar parameter. We want to plug the red channel of the texture into the A of the new multiply and the new scalar parameter into the B. Name the parameter Flake_Size and set the default to 20, a figure which works well for this texture. Don’t forget to add our two new parameters into the flake parameter group.



That's all we need to drive the flake mask. To apply it to our system, we will use a “MatLayerBlend_Standard” node. All you need to do is  plug the result of our bases MakeMaterialAttributes node into the Base Material (MA). Plug the results of the Flake MakeMaterialAttributes node into the Top Material (MA). And finally, plug the result of our Flake_Mask into the Alpha. Now all you need to do is plug Blended Material into the final Material Attributes node and our Flake Mask is finished and working.



Save your work and take a minute to play around with the material instance of our shader. See what type of surfaces you can generate with the system we have so far. You might notice that without reflection, it doesn’t make for a convincing car paint.


Ever since Update 4.3, there has been a new shading model to consider using. The system is called clear coat and what it essentially does is render a separate layer on top of your material, giving it a glossy look. Update 4.4 brought new nodes to control the amount of influence the clear coat has, as well as the roughness. This is a really handy shading model if you are looking to create a material for static meshes. You can experiment with the Clear Coat shading method and get very good looking results. Unfortunately though, the reflections of the system still rely on the static scene capture nodes and screen space reflections. It is possible to create a good looking system which performs well in engine, using this method, but the purpose of this tutorial is to create a system with fully dynamic reflections. So we will not be taking advantage of this new shading model.

Clear Coat Shading Model



Our complete shader will be using a real time scene capture node to simulate reflections. This means that our material will take a considerable hit on performance. Not only do we have to render the scene for the player; we have to render twice again for reflections. Consider this when you are using this system for your own project. Do you need more advanced reflections, or better performance? If you do need better performance, the clear coat shading model will work well and still produce visually appealing results. Perhaps in the future I will revisit this shader and utilize the clear coat model.

For now, lets move onto the next section of this tutorial. Reflections.