Free Stuff‎ > ‎

Car Paint

Attached below is a zip file containing a car paint shader for Poser 5 and up. It contains a material file, BBCarPaint.mt5, and a PNG thumbnail to go with it.
 
Unzip these two files into the runtime of your choice, somewhere in a materials folder.
 
There are an infinite number of different paints this shader can produce. Rather than try to give you a specific set of colors and styles, there is just one shader, with some nodes in it on the left side that make it easy to configure it how you want it.
 
This shader implements gamma correction so it looks right even if you don't have Poser Pro or Poser Pro 2010. If, however, you have one of those and you enable render GC, you don't want shader GC. This shader will automatically detect that render GC is in use, and disable its own shader GC automatically. So you don't have to touch it. However, if the shader GC is active, there is a parameter node to let you specify what gamma value to use for the shader's internal gamma correction.
 
In addition to GC, there are two very important effects necessary to produce a realistic car paint; the Fresnel reflection effect, and the principle of conservation of energy (CoE). The Fresnel effect is that reflections increase as the viewer's angle of incidence with respect to the surface approaches 0. There is a specific curve for this, and this shader implements the exact Fresnel equation. The CoE effect is that when light strikes a surface, it can bounce off cleanly in a specific direction (a specular reflection) or it can diffusely reflect in a random direction. The proportion of photons that do specular versus diffuse reflection varies with different angles of incidence, but the total amount of reflected photons coming off the surface cannot be more than the number of photons that struck the surface. Poser doesn't actually implement photons, but we must respect this phenomenon in a shader that implements significant specular reflection. Basically, if the specular effect is strong, the diffuse effect must be weak, and vice versa. Because a metallic paint shader, particularly a pearlescent one (lustrous, glossy), has such a dominant specular effect, getting the right appearance requires that the CoE is respected.
 
This shader will look OK without real reflections, but for maximum realism, you should render with raytracing enabled, at least one bounce, and have something for the shader to reflect. I suggest an environment sphere. Lucky for you, I provide one free on this site.
 
NEW (July 13, 2010) This shader has been updated and now supports the use of an environment map instead of an environment sphere. Use it to generate decent reflections without enabling raytracing. Or, use raytracing to pick up nearby objects, but use the environment map in the shader to define what to reflect from an otherwise blank environment. Also, the Color Map node was mistakenly labelled PM:Color Map. This has been fixed.
 
Parameters
 
PM:Gamma (Auto) - The gamma correction factor to use in the shader's internal gamma correction. If render GC is in use, this is automatically disabled. To force GC off internally, set it to 1. The default value is 2.2 and should be used in almost all cases.
 
Color Map - (optional) Load a color texture into this node if you want to use a texture set with this shader. It can be safely left blank.
 
PMC:Diffuse Color (Tint) - This parameter works in one of two ways, depending on whether or not a Color Map is supplied. If no color map is supplied, this parameter controls the base diffuse color of the shader. If a color map *is* supplied, this parameter is multiplied with the colors in the map, thus tinting the map. This is particularly useful with gray-scale maps where you want to supply a hue overlayed on the luminance of the map. But you can also tint colors. For example, you can easily reduce the amount of blue in the map by removing some blue from PMC:Diffuse Color (Tint).
 
PM:IOR - The "index of refraction" controls the particular rate and degree that reflections increase with decreasing angle of incidence. While there is no actual "refraction" happening in this shader, the concept of IOR is commonly used to specify the parameter needed control the Fresnel effect in a realistic way. (The glossy "clear coat" layer on top of car paint actually *is* refractive, and the index of refraction controls the reflectivity as well.) The IOR of water is 1.33. The IOR of glass is typically around 1.54. The default value of IOR in the car paint is 1.45. Decreasing the IOR will make the surface less shiny. Do not decrease it below 1. Increasing the IOR significantly past 2 will make the surface appear more metallic. Since the "clear coat" layer on car paint is not a metal, you shouldn't go much past 2 for realism. (In real life, certain extremely expensive paint jobs can get the IOR up to 2.)
 
PM:Reflection Value - Use this to adjust the total maximum reflection. In a well polished, clean, expensive car surface, the maximum Reflection Value might be .85, no more. However, your reflective environment may be dull and need a little boost, so increasing this may be appropriate. On the other hand, if the surface is not perfectly clean and smooth, then a lower value should be used.
 
PM:Pearlescence - Makes the paint appear lustrous, like a pearl. A value of 1 is very pearly. Set this to 0 for a normal paint. The color of the Pearlescence is automatically derived from the base Diffuse Color.
 
PM:Sparkle - Makes the paint appear to have little metal flakes in it, and when the light catches it right, you'll see this. Note that the sparkles may look dirty and incorrect if you use poor render settings. The Min Shading Rate should be .5 or less for best results.
 
Environment Map - (optional) Load an equirectangular image here to provide an environment map. To actually use it, you must adjust the PM:EnvMap Value parameter to a non-zero value.
 
PM:EnvMap Value - Specifies a brightness control on the Environment Map. The default is zero because empty ImageMap nodes generate white. So we need to able to turn it off until you actually provide an image. When you do, set this to 1. However, if you find the Environment Map you're using isn't the brightness you want, you can increase or decrease this value. For example, if set to 1.5, the map will be 50% brighter.
 
PM:EnvMap is HDR - Specifies that the Environment Map is High Dynamic Range image, with a gamma of 1. If you are rendering with Poser Pro render GC, this parameter is not used. If shader GC is enabled, setting this to 1 prevents the image from being anti-gamma corrected since HDR images are already linear. If you're using a JPEG or PNG instead, set this to 0.
 
Examples
 
Here is a sampler of various values of the shader.
 
In the first image, each column is the same diffuse color. From left to right is black to white.
 
Each row varies the Pearlescence and Sparkle. In the front (bottom) row, they are both zero, i.e. turned off. In the back row, the Pearlescence is 1 and the Sparkle is 1. Various intermediate values appear in the middle rows.
 
 
 
In this image the Pearlescence and Sparkle vary as before, but the colors go from dark red to a pearly off-white.
 
 
In this image, a sampling of rainbow colors is demonstrated. Also, the sparkle varies from 1 (front) to 3 (back). The Pearlescence varies as before.
 
ċ
BBCarPaint.zip
(11k)
Ted Czotter,
Jul 13, 2010, 12:58 PM
Comments