Grand Tour Part 1: Rendering a Car
In this "How To" guest contributor Leif Pedersen will show us how to take advantage of the plausible shading system in RMS 18 to shade and render a hovercar and a metallic street sign.
Going over every single attribute in the GP shader is beyond the scope of this training. Instead we will be going over specific useful attributes needed to accomplish our look development.
Our retro-future car is made from several different materials. In this chapter we will be going over useful attributes and tips that will help us successfully depict the following materials with the plausible shading system in RMS 18:
Before we start, please open the car.mb Maya scene file, which will ensure the best interaction possible with this training.
Rendering metals convincingly can be very time consuming; ray tracing can take a toll on rendering time, so it's very important to understand the GP shader's specular attributes to help us achieve our desired look while rendering as efficiently as possible.
Metal can be coated many different ways. Since it's the future, we can take some artistic liberties. Looking at our metal reference, we can see that true chromium can differ a lot, as seen in images from movies like Rango and Meet the Robinsons. Each look is also dictated by the technology available to the technical directors. These are some of the limitations we need to consider when making choices for our metal shader.
For our hovercar we will be trying to achieve something in the middle, not too realistic, not to cartoony, but definitely shinier. Somewhere along the lines of a highly conductive Chromium or Germanium.
Let's look at how some key attributes of the GP shader can help us achieve our look.
One of the most important attributes for convincingly portraing metals is specular irregularity. The Roughness attribute can help us control how polished or rough a metal is, painting irregular patterns of roughness can greatly increase realism in our render. It's important not to overdo our roughness, because at some point the difference between a very diffuse and a very rough surface is almost none, making the expensive specular rays redundant.
One of the most important settings for controlling specular irregularity is the Specular Gain. This value can receive luminance inputs to determine how strong the specular is across the surface. It is always useful to add scuffs and scratches to this value with a grunge map in order to vary intensity across a surface. We are using a painted map for our chrome shader; even the slightest irregularity will go a long way for a convincing chrome shader.
Another very important attribute is Mode. This attribute dictates whether ray tracing or reflection occlusion will be used to calculate reflections. Full ray tracing can be very expensive, but will use the entire scene to calculate the most accurate reflections in the shader. Direct, on the other hand, will only sample lights, but will also use reflection occlusion, which simulates the reflection of objects by evaluating the presence of geometry and not the shader. Reflection occlusion can offer tremendous rendering efficiency while maintaining a convincing reflective look.
For an in depth explanation, visit the Reflection Occlusion section of Renderman University.
Anisotropy controls the shape of your specularity. This attribute can have a tremendous impact on the look of our shaders, because reflections will curve and follow the topology, helping us achieve a brushed metal look. There are several other attributes that must work in conjunction for Anisotropy to show up properly in your renders:
- Roughness must be greater than 0, usually a value of 0.2 will start to show noticeable anisotropic properties. .
- Anisotropic direction depends on various geometry factors, including UV's, geometry type (polygon, NURBS, SubDs), and the GP shader's Tangent Source attribute.
In the Advanced Specular tab we will find the Tangent Source attribute. This attribute is crucial for the direction of the anisotropic specular.
- Default uses the dPdu of the surface to compute tangents used for anisotropy and tangent space encoding. This is a built-in vector provided by the shading system, therefore no extra computation is required. If topology is poor, strange reflections will be visible.
- S computes a gradient from the ST (UV) coordinates. If the mesh has no UV's then it might render black or default to dPdu. Does not work well for auto mapped UV's, as direction will change across seams. Works well for proper UV's with poor topology.
- Mesh uses generated tangents from a poly mesh. In order to generate the necessary tangents, select the poly shape node and add a RenderMan attribute called Output Tangents. This incurs in extra computation.
- Input uses a texture map to generate and compute a tangent for the mesh. Simple gradients work best, but any image can be used to create custom and creative effects. The texture map must be attached to the Tangent Gradient attribute. Works best for UV's with similar direction.
Max Specular Value
This very useful attribute clamps the specular values to make sampling and image filtering more efficient and reliable, effectively avoiding speckles and artifacts associated with physical rendering. For example, if set to 1, then no rendered value can exceed 1, even if floating point image formats are chosen. Useful values are 2 - 10, which keeps the fstop range reasonable and efficient.
Lets take a look at our car's chrome shader.
You will notice that I've increased the Max Light Samples and the Max Reflection Samples from 16 to 32, this will ensure we are sampling high enough in rough areas where we would otherwise get noise. RMS will use the Max Samples parameters intelligently - it will only sample as high as it needs. That's why keeping the Min Samples at 1 is sufficient in most cases.
Also, note that I have the Max Specular Value in most shaders set between 2 and 4, which will ensure we don't get speckles or artifacts in our renders.
Lets take a look at the shader for our Street Sign.
You'll notice that we have the Surface Color and Specular Color being driven by the same diffuse texture map, this is because unlike dielectric materials like plastic, conductor (metallic) materials always reflect the same color as their diffuse, for example the highlight for gold is yellow, not white. We are also driving the Metallic attribute and the Specular Gain attribute with a painted texture map that separates the rusted parts of the sign from the shiny parts. We also have a clamp on the ramp that drives the Metallic attribute, because we don't want the sign to be fully reflective like a mirror.
Note that we have set the Tangent Source to S, which will help us benefit from nicely layed out UV's and achieve a nice straight Anisotropic specular, even though our topology is poor. Another interesting trick is the noise procedural driving the bump of the shader. This will give the reflections an interesting bend that will make the sign look older and weathered.
When working with Mudbox, try to export FBX files to keep Maya creasing. Renderman's subD's work great with Maya creasing and will allow you to add interesting beveled edges without adding unnecessary geometry.
Our retro-future car needs a unique paint job. One of the interesting features of the GP shader is its ability to generate metallic paint flakes. When combined with the metal controls, paint flakes can create unique and interesting patterns for our car paint shaders.
This image of Finn McMissile and Mater has the perfect combination for our look development. We need to get a rusted and weathered look for the bottom of our vehicle, and a shiny metallic paint job with a clear coat finish for the rest of the hovercar.
Let's see how these GP shader attributes can help us achieve our intended look.
The Flake Amount can be art directed freely. The flakes are random deviations of the base normal, so beware of adding too much, because the pattern can start looking like strange noise throughout our shader, especially in animation. We are choosing a value of 0.15 for our car, anything larger and we will get white artifacts at certain angles. This needs to be dialed in carefully depending on the surface curvature.
The Flake Frequency is the size of the flakes across the surface. It is not in world space, so we need to tweak the size per-object to get the desired look. We settled at around 10 for our flake frequency, because it's a good look for the shot distance. Anything larger and we will need to much filtering to stop the flakes from flickering, on the other hand, if we go too low we risk the flakes looking too large.
We also need to make sure we have a high IOR (Index of Refraction) or a value greater than 0 in our Metallic attribute to see the metallic flakes. As we can see in the example below, the flakes add an interesting pattern to our specular.
Back to our car paint shader.
Metallic car paint darkens at glancing angles and slightly shifts color. To create this effect we are driving the ramp's V coordinate with a samplerInfo node's facing ratio. Previously painted texture maps are driving other attributes, such as the surface color and the specular gain, so that the muddy bottom of the car does not contribute to specular shading.
One of the most important things about this car paint shader is the use of the secondary specular lobe, which helps us achieve a clear coat on top of our metallic paint layer without resorting to a co-shader. A similar ramp is also driving its specular color, but it's more desaturated to avoid heavy tinting of the environment. I have kept the Roughness to a minumum and have set the Specular Blend to 0.5. This will keep only 50% of the secondary specular and 50% of the primary specular. Watch out for overriding one with the other or else the layering effects are gone. We will also use a Full specular Mode on both specular lobes to reflect the entire environment for a more accurate reflection, especially the ground.
Because of their size, metallic flakes are hard to filter properly. To overcome this, I have added a Shading Rate attribute to our Car Paint Shader that will override the global setting. I have set a Shading Rate value of 0.5, which will ensure our shader is always subdivided twice per pixel.
Glass is usually very expensive to render. That's why RMS 18 has a specialty GP Glass shader that is optimized for the complexities of plausible shading. In this section we will go over the advatages and disadvantages of using the GP Glass shader for our car. We will also be going over the option of using a GP shader instead of the GP Glass shader to create an interesting weathered glass look while minimizing render times.
Our look dev calls for glass that does not obstruct the character and reacts nicely with the environment. It also needs to be thin and refract little, while being dirty from the road. In these reference images we can see some useful examples, from Buzz's clear plastic dome to a picture of old weathered glass. We need to strike a balance between these images.
Let's see how some useful attributes and nifty tricks in the GP Glass and the GP Surface shader can help us achieve our intended look.
Even though the GP Glass Shader can give us a fast and photorealistic glass look, refractions are much slower to render than the GP Surface Shader. If we sacrifice accuracy for a convincing look, we can get a very nice glass look with the GP Surface Shader.
As we can see here, shading the glass with a GP Surface shader with Direct reflections is very similar to Full reflections, but 3 times cheaper to render. The GP Glass is nice and refractive, but lacks the interesting weathering that the GP shader can produce. It also needs more specular depth to produce acceptable results, which increases render times.
We will use the GP Glass shader for our headlights, where we have modeled in some detail to refract nicely with our light bulbs.
Since our car has lightweight and thin glass, a non-refractive shader will do just fine, especially if we can take advantage of co-shaders and masking. It's a good compromise for our shot.
Let's take a glance at our "cheap" glass shader.
We are adding weathering and transparency irregularity to our main shader with a co-shader. The co-shader has a grunge map that gives it irregular color, but most importantly has a painted map connected to the Mask input, which cuts out the co-shader and makes it more opaque in certain areas. We are also using a clamped version of the transparency map to drive the Roughness of the main shader. This will ensure our lights get reflected with varying intensity. Last but not least, we are adding a painted map to break up the overall specular of the main glass shader. This weathering will give our specular component some nice scuffs and scratches.
Most importantly, I have chosen to go with a Direct specular Mode. This is a good compromise between design and efficiency. It will give us a thin glass look while decreasing render times, compared to Full specular. We will also be able to see our furry character unobstructed when it's in the car, just like Buzz can be seen unobstructed through his visor.
In this section we will be going over a leather material, along with Mudbox exporting options for normals maps, which will give our leather much needed folds and stitching.
Our look development calls for tight-fitted leather, not old and wrinkly. It also has to absorb some light to smooth out the folds. We'll try to stay away from too much grit and dirt for our car seat, so we can stylize it a bit more. In the painted texture you'll notice some coffee stains and some slight weathering, but not much.
Let's go over some useful GP shader attributes for our leather material.
Normal Map import
In order to use our Mudbox normal map we need to understand the GP Surface displacement attributes. The first thing you will notice is that Bump needs to be selected even though we are not connecting a bump map, this naming convention is just a way to divide displacements and non-displacements into two simple groups.
The Encoding in normal maps is always centered, so we will keep it at the default. Also, RMS makes it very easy to choose a normal map from either ZBrush or Mudbox from the NormalMap mode drop down. One important thing to note is that the map needs to be connected to the Input Normal, not to each channel individually - doing so will not work.
It's best to remove or minimize texture filtering by adding a renderman texture attribute to the file node and setting the filtering from 1.0 to something like 0.1 or less. This will improve texture sharpness and is especially noticeable for fine detail in displacement, normal and bump maps.
Another very important attribute for convincing leather is Subsurface Scattering (SSS). Most leather absorbs some light, so it's a good thing the GP Surface shader has built-in Subsurface Controls with support for both ray-traced and point cloud based calculations.
To activate the SSS calculations we need to set the Diffuse Mix to something above 0. This parameter is substractive from the Diffuse, so a value of 0.4 will mix 40% of the direct lighting into the shader. The GP Surface shader will decrease diffuse lighting automatically.
We also need to set the DMFP and DMFP Color values appropriately. These two values are very important, because they dictate the distance and color of the scattered light through the surface.
The DMFP, or Diffuse Mean Free Path, is the distance the light will travel through the surface before scattering inside. This means you will only see the effects of direct lighting penetrating the surface until the light starts to scatter based on this attribute, at which point you will see the effects of the DMFP Color.
In this example, we have used the DMFP Color values for whole milk <<10.90, 6.58, 2.51>> and we can see how the shorter blue channel starts to dominate the surface color as the other channels are still going deep into the surface.
This attribute is a little tricky. The DMFP Color is a measurement of scene units rather than color values, so although you are choosing values through a color swatch, you are actually choosing per-channel absorption. Because of this, it is very common to see large float values in the inputs. For example a value of <<5,8,4>> would mean the shader will absorb 5 units in the red channel, 8 units in the green, and 4 units deep in the blue channel. For a list of useful values, please refer to the scattering values in the RMS documentation.
The color swatch will always look wrong when large values are used, because Maya is trying to represent a color value, not a unit value, so any value above 1 will be represented as a white swatch.
Now that we understand the RMS attributes, let's take a look at some useful workflow options in Mudbox that will allow us to properly interact with RMS.
Naturally we will want to subdivide our model for painting and sculpting, so we must choose the right settings in order to avoid unwanted seams and artifacts. Since RMS respects Maya's creasing we need to make sure we choose properly in the Mudbox subdivision tool options.
Mudbox Normal Map Extraction
Since the car will not be a high detail foreground element in our final shot, we only need a normal map. This will ensure we get our necessary leathery folds at render time without adding unecessary geometry.
Make sure not to smooth UV's during the export process as this will create artifacts. Mudbox already has subdivided the UV's and properly distributed geometry during the subdivision process.
Our car will not be in the foreground in our final shot, so a 2K normal map should be enough to convey the leather folds. Also, make sure to use raycasting to keep small detail.
We will also compensate for the smaller resolution by exporting at a high color depth. It is beneficial to always choose a high color depth format for use with RenderMan because color information fidelity outweighs render time increases. Also, modern formats like EXR were made for high color depth and are very efficient in their consumption of disk space.
To give ourselves a little breather, in this section we will be going over our car's plastic console interior.
While making the car interior, I tried several different textures; in the end, I really liked the fiberglass pattern. Since our vehicle is futuristic, we can take some artistic liberties, especially if it looks good! One of the things I wanted to keep was weathering (even though in the future everything will last much longer...right?), because having surface aging where the hands touch the steering wheel is essential to taking away that new car look.
I had previously painted a worn plastic texture in Mudbox and exported it as a 2K texture map. We will be using it to add color and a slight bump to our car's interior. We will also be using a luminance node to make sure our network has the right connections when dragging and dropping the texture onto our GP Surface shader value inputs.
Even though it's a simple shader, one of the main things to note is the large specular Roughness to simulate a softer, rubbery plastic. The specular Mode is also set to Direct since we don't need complex inter-object reflections for such a diffuse shader. Unlike metals, plastics always reflect white, so we need to keep the specular Color white.
There is always manual tweaking to do to get the desired look and strength of bump in our shaders. The Displacement Scale helps us art direct the subtle bump needed for our rubbery plastic. When using bump maps always use a Centered Displacement Encoding, this means your maps are in a 0 - 1 range (and are probably 8-bit).
Our futuristic dashboard needs a little bit of light bounce. To accomplish this we are going to take advantage of the new geometric area light attributes in the GP shader. This will allow us to emit light into the scene without having to resort to bounce lights or other innacurate methods.
As we can see, adding a little bit of bounce light can add a lot of realism to our car and best of all, we can emit light using the same texture as the dashboard which will ensure accuracy. To do this, we need to take a look at the emissive attributes for the GP shaders.
The color of the Incandescence will drive the light emission. We are mapping our dashboard texture, but we don't want the dashboard to be affected by our choices in lighting. To avoid this connection, we need to have two dashboards, one for render and one for lighting, this will allow us to have complete freedom of our dashboard light without having to worry about overexposing our dashboard at render time.
The lighting dashboard will not cast shadows, this will avoid lost light samples on the light source. It will also be single sided to avoid casting light in both directions.
This works like any other physical Geometric Area Light. The intensity duplicates each time we go up an integer, so a value of 6 is double the intensity of 5. The default emission value of 0 has an intensity of 1 and negative values are also valid intensities.
This will control how wide or narrow our emission will be. I'm using the default values to simulate a wide diffuse light.
For more information on these attributes please take a look at the documentation on RMS Geometric area lights
Remember to use Specular settings to your advantage. Use Roughness and Specular Gain to effectively weather your shaders and make sure you get creative with the Tangent Source in order to achieve unique Anisotropic patterns.
Try using Flakes when creating metallic paints and vary the levels of color and diffuse intensity in the shader by using the camera's facing direction to your advantage.
The raytracing Mode will help you leverage accuracy and efficiency by using reflection occlusion. This will ensure you are being as efficient as possible with raytraced materials.
Always remember there is an alternate way of achieving a desired effect in RenderMan Studio. Choosing the right shader for the job is key, choose wisely between the GP Surface, GP Glass and the GP Matte shader.
Get to know the Subsurface Attributes in detail, especially the DMFP and DMFP Color, as they will make or break an SSS shader.
Use Geometric Area Light attributes on the GP shader to emit light from objects. No more bounce lights!
Always remember to prepare a pipeline with anticipation. Understanding other software such as Mudbox and its interaction with RMS is crucial to establishing a solid workflow.