TechiWarehouse.Com


Top 3 Products & Services

1.
2.
3.

Dated: Aug. 12, 2004

Related Categories

Maya (3D Animation)

By Steven Stahlberg

The devil's in the details

I'll make a sweeping statement - good cg pays attention to the details, bad cg doesn't - true about anything I suppose, but even more so with cg. This doesn't mean a cg image necessarily and always has to be realistic, like a photograph is realistic - but in practice, it turns out that's usually the direction it should be taken - not all the way all the time, but usually in that direction. First let me define what I mean by 'realistic detail' here.

The universe around us has everywhere we look a certain hard-to-describe chaotic, natural "richness", the opposite to "mathematical perfection"; the dirt and dust on our man-made things, the accidental factors that flaw them, the dents, cracks, spots, mold and rot, the branching of trees, the varying shapes of mountains... The poor 3d artist has to jump through all sorts of hoops to achieve this kind of richness. This is because what we're dealing with in cg is just math. Some of what we enjoy resting our eyes on most - subtle variations on a theme, rich and changing detail, is alien to the computer, in fact the direct opposite to what it does best. (Or perhaps it's just that the math and algorithms it uses isn't evolved enough yet, in any case the result is the same.)

True, the computer is good at fractal detail, and patterns, but without human interference there is a uniformity that quickly becomes boring, and worse: ugly, uncomfortable to look at... (I discuss why in more detail in part 2, and in my Essay on Image Composition)
So a single layer of fractal noise just isn’t enough – we want... more. We may not be sure what, but we feel something's wrong, something's missing. I've been trying to define more precisely what.

Every successful image (one that for one reason or another appeals to a lot of humans) has some or all of these aspects:

1. Detail (complexity)
2. Variation of said detail, on several levels: Variation of the variation, and so on
3. Discontinuities between different areas (and therefore borders, edges)

Reality has this in spades, just look at a real sunset or mountain or forest. These aspects do not as a rule come easily and naturally in cg. This is why I hold reality up as the standard to reach.

How to apply the 3 points above to our images? Here are 6 things to remember.

Below is an image deliberately created to be as unrealistic and ugly as possible. Notice how confusing, flat and uninteresting it is to look at, how alien to our depth perception etc. True, the color scheme is ugly too, but this is not the main reason why we find it uncomfortable to look at this for any length of time. Hardly any edge is defined, there is some detail and discontinuity, but not enough of it, and hardly any variation and randomness of the detail. This leads to a compositional problem, mainly due to poor distribution of the contrasts, the foci of attention. How do we fix this horror? The easiest and shortest route would be to try to make it more realistic.

 

1. Shading
Add shading to the objects in the scene, this raises the complexity/variation level, improves depth-cueing and adds more discontinuities. This may seem obvious, but I start at the beginning to better make my point. In Maya it's just a matter of placing at least one light, and making the shaders NOT 'Lightsource' or incandescent (and very rarely Lambert actually, even the mattest materials may have some small highlight, see the shading section below). Note that the ambient light is too strong in the left one below (a common mistake), and corrected at right. We want the darkest shadows to be dark, almost black but not quite, except maybe for small parts of the image. (Unless we're going for a high-key scheme, I'll discuss that in the lighting segment.)

 

2. Shadows
Now let's add shadows - this also seems simple enough, but this step is very often skipped, and it's amazing how much some simple shadows can add to an image. We add them to all objects that are not transparent, except if the shadow directly interferes with what we are trying to achieve visually, of course. Also let's fix the

3. Texture complexity
All textures must be above a certain level of complexity, or they must be very muted and subtle. NEVER use a simplistic texture, like a procedural (fractal noise, ramps etc), on it's own with very high contrasts, or strong colors. Watch out for strong colors - a surface that only reflects light and emits none of its own, should never have a 100% saturated color on it. Also, on composition - don't cover too much of your image area with a very strong color.

 

4. Modeling or texturing detail
Thin planes not very far away must have some thickness, bevels should always be added if visible, subtle details - there are never enough, so add more if you can (fillets, flanges, ridges, dents, seams, bolts, panels, defects, dirt, etc), and the polygon resolution must not be too low in rounded objects (if you can see the facets, it's too low). Points 3 and 4 is where 50 to 90% of all the effort and time should be placed (depending on the image) - a good general rule is: The More Detail And Variation The Better. Now I don't mean you should go putting 10,000 exact copies of rivets on a wall - there's no variation in that. To stick with the riveted wall as an example - you should add as many rivets as will look cool (never add detail that will not be seen!), but make sure some of them are different from the others. Also make sure they are not evenly spaced and in perfectly straight lines (and maybe some are missing), that the wall is slightly bumpy and buckled, maybe scratched and dented, that some dirt has collected around the rivets and maybe some rust has run down the wall from some of them (making sure to VARY the length, color, shapes and transparency of the runs IF this can be noticed), the wall should have a different texture at the top than at the bottom, etc etc... The keywords here are SUBTLE and VARIATIONS.

 

Here I've also added some GI-fake effects, like ramps on some textures, and used raytraced soft shadows. That falls under:

5. Realistic lighting FX
Like radiosity or GI, caustics, anisotropic highlights, etc.

6. Post effects
Motion blur, if you have fast movement (fast as measured in screen pixels per frame, not absolute speeds). Depth of Field if necessary/applicable. And lastly: Gaussian blur and film grain, in that order (do that always, a computer will render things too sharp and smooth).

Additional notes:
Be careful with Glows and Lensflares - beginners very often use too much of these. Study real flares and glows to see how to do it.

The concept of multiple pass rendering for later compositing is a very useful one, and can be used in many different ways to speed up production, and add flexibility and choices towards the end of a project. It can be used to separate light sources and their effects on the scene, it can be used to create your own motion blur, it can be used to separate glow effects, particles, foreground/background, super-high-resolution parts from normal or low res, raytraced effects from raycast, faked fog and faked Depth-of-Field effects, etc.

About textures

The best texture is almost always a retouched photo. Why? Because we're directly using a piece of 'Reality', with all that entails in regards to chaotic patterns, detail and variation.

An example: let's say you once took a series of photos of a rusting truck in a junk yard, on an overcast day (the best kind of lighting for texture shooting), and one of these photos has a beautiful rich texture that Giger himself would have envied. You crop it, darken an area, remove an intrusive shadow, add a number and a logo, etc, and hey presto, it's the best space ship texture you ever saw. Now try to paint that on a blank canvas - without looking at the first photo. If you don't know what I'm talking about, try it - you'll soon see what I mean.

The best tools to use for photo retouching are the clone/stamp tool, and filters applied in masks with varying degrees of feathering on the mask borders.

The worst texture is usually a simple straight forward procedural with no layers.

Sometimes worse are the ones hand painted from scratch in a computer. The reason for this is partly that painting anything is very difficult, and especially using a computer. Mainly there's the problem with the pen tool. A real airbrush, for instance, should never be used freehand, the results are almost always terrible, it should always be masked one way or another, with a loose or stuck down mask (especially loose-masking is very quick and interactive).

Same thing applies to the computer (except it's even worse because the pen tool is much less flexible and controllable, and since getting a loose-mask effect is so tedious we tend to avoid trying). The reason the result looks so bad (if we don"t watch out) is the uniformity and smoothness of the lines, sometimes with the little globules at the start and end of every stroke. An example:

Things that will help this problem (using Photoshop terms): taking the extra time to change the stroke length, transparency, color and size of the brush VERY often, using smudge, using many different selection-masks with different amounts of feathering, a pressure sensitive tablet and stylus, adding many different filters in many different masks, working with many layers.

Avoid repeating textures at all costs - an example: you have to shade the floor of a large hall with a granite texture. It's a nice texture, but the problem is it's not big enough (not surprising), it has to be repeated 100 X 150 times at least. But when you render a view from average human eye-level looking across the hall, you see this horrible weird zig-zag pattern extending across the floor. Mirroring and Staggering doesn't seem to help, in fact Mirroring made it worse by making the zig-zags bigger. How to fix it?

One way is to use a 'smear-map' (look it up in the manual) with much less repeats than 100 layered on the main texture - a subtle one will be enough. Another way is to layer textures on each other, with different repeats. Say you have a checkered pattern that repeats 12 times across a floor - layering another texture (same or different) on top in either the RGBmult or RGBoffset that repeats 11 or 10 or 9 times will make it less repetitive.

Another way is to open the image in Photoshop, paste it as many times as you like in a larger window, and then make sure it's non-repeating by painting and retouching, then reapplying it in your shader with less repeats. But be aware that this creates larger image files, eating disk space, RAM, and slowing shader-updating.

 

Shaders:

(Disclaimer: the below was first written 1998, and some parts of it are now obsolete.)

First let's try a simple common case - a non-reflective smooth opaque surface of a uniform color, maybe with just a touch of specularity, like metal painted with matte or satin-finish paint. Let's say our rendering brings us close, so we want to go for maximum realism. Whenever that happens we should map as many channels as possible - in this case the specularity channel, the color channel and perhaps the bump channel. Let's use Blinn, it has a satiny look to it, and has an extra parameter that Phong doesn't have (the Rolloff, makes the highlight light-direction dependent). Let's put a very low amplitude sFractal texture in the color channel. In Color Balance, make both Rgbmult and Rgboffset the same Hue, then flip them so that the top one, Rgbmult, is around 0.1, and the Rgboffset is around 0.9. You now have a barely discernable texture. To adjust the lightness of the texture fiddle with the Diffuse slider. The same texture can be reused in the specularity channel, only offset a bit, and both the Rgbmult and Rgboffset at about 0.1. Also, if your main Color is strong, add the complimentary (180 degrees from it on the Hue slider = opposite on the color wheel) color into the Spec texture - just enough to create a greyish highlight (about 50% purple if your main Color is 100% yellow etc), don't overdo it so you can actually see the opposite color in the highlight. This helps on anything not metal, especially when its strongly colored.

You might also add a similar faint texture in the bump channel, make the Amplitude and the Amult 0.14. We have to get rid of the sterile flat smooth cg look at all costs.

 

The first one is untextured Blinn, the second has the Colormap mentioned above, the third also the Specmap. I could have stopped at the second one here, but usually it's best to map as many channels as possible.

For extremely matte porous materials such as raw sandstone, or earth, or vegetation seen from an airplane (it's darker not brighter where you'd expect the highlight to be), you should use not Lambert but Phong with a negative Specularity, like -0.1 or more.

Next - layers. This technique is most useful when you need to stretch the limits of what Phong and Blinn can do with their highlights, as in pearls, metallic car paint, wet, slimy or lacquered things etc. In this case I used it for the peculiar matte painted finish on the A10 Warthog, which I didn't seem able to get any other way. The lower layer is Blinn, Diffuse 0.8, Rollof 0.7, Eccentricity 0.7, Color and Spec maps like this:


The layer on top is Blinn, Rolloff 0.64, Eccentricity 0.34, the same Spec map, and of course full Transparency. Together they look like this:

 

Now let's add reflections, reflection-mapped ones (raytraced reflections shouldn't require any changes to these shaders). This is a basic carpaint shader, lower layer is Blinn, Diffuse 0.56, Spec Value 0.4 (medium gray), Rolloff 0.14, Eccentricity 0.5, Reflectivity and Glow 0, and whatever color you like, in this case HSV 256 0.47 0.93. Again, if the main Color is strong, we put some of the opposite color in the highlight (not on metals!). That takes care of the highlight produced by the bright part of the sky near the sun - but for the sun itself we need a much stronger highlight, and keeping it on a separate layer also gives us the chance to easily add realistic starry glow to it: Layer this fully transparent Phong shader on top: Spec 0.6 (with some opposite color here as well if applicable), Shinyness 150, Reflectivity 0.14, the following file in a Ball Reflection map:

 

If the main Color is very saturated, tone this image in the same hue using its Rgbmult and Rgboffset.
Make Glow 1. In the Environment, switch Glow to linear and Halo off, Quality 5, Threshold 0.38, Glow Color full white, Intensity 10, Spread 0.25, Eccentricity 0.005, Radial Noise 0.74, Star Level 1.16, in Radial Effects: Star Points 20. The result is on the left. On the right is a 'flake' finish car paint, the only changes are in the bottom layer, in the Spec HSV: 256 (change this value to any color you want, but it should be the same as the main Color), 0.57, 1 - Eccentricity 0.47, and Color Value darker, in this case down to 0.6.

 

A shader for shiny metal, say gold: Blinn, Rolloff 0, Eccentricity 0.46, Color should be dark fully saturated red, Diffuse 0.1, (the color of a colored metal comes mainly from the Spec and the Reflections). Specularity HSV 37 0.47 0.56, Reflectivity so it looks like a colored mirror - in this case 1 (note that Refl. is dependent of Spec). Be careful not to create a "super-mirror" that has reflections brighter than the environment - it'll look like some weird incandescent plastic. Tone the image in the Ball Reflection map with a bit of yellow in the Rgbmult, and a bit of dark fully saturated red in the Rgboffset. No glow.
Layered on this is the same one as on the previous two.

 

The matt gold on the right has no layers, it's Blinn Diffuse 0.5, Spec slightly higher S and V, Rolloff 0.13, Ecc 0.58, Refl 0.44, Reflection map blurred with Bluroffset at 0.1, Color HSV 28 0.5 0.7.

To look shiny an object needs areas of contrasts, areas of smooth transitions and areas of sharp transitions - the sharper those transitions and the stronger the contrast, the shinier it looks.

If raytracing remember to put a full "interesting" environment around your table, maybe just a sphere (with shadows turned off) with an image mapped in a Lightsource shader. (If that sphere then becomes visible in your background, place and scale a rectangular plane with the same proportions as your view and your choice of shader, so that it just barely hides all of the sphere in that camera.) To raycast (using Dmaps) put a Ball reflection map on the shader. To make your own Ball reflection map, build a whole room, raytrace a perfect mirror-sphere in the objects place in a camera with Zoomangle 2 from the same direction (but much further away) as your main camera, crop it close to the sphere, retouch it and use that as a reflection map in a Ball Environment texture. Is your object composed of totally flat surfaces with sharp angles between them? (Flat shiny surfaces are much harder to light and shoot nicely.) If so, maybe introduce a slight curve, bulge or bevel.

About refractions

In a closeup of a water drop the reflection matters much less than the refraction. The image below shows a raytraced drop shape with a water-shader applied to it, in front of a background image. What you see inside the drop is the refracted background (the drop acts as a lens). This is controlled by setting the water-shaders Refractive Index (RI) to it's appropriate amount, roughly 1.3 (although this is flexible - remember it's the result that counts, not physical correctness).

In this example (from a tvc for a Hong Kong chain of department stores) we needed to get a particular refraction inside the moving drop of water (their logo), so I placed a plane textured with a specially painted texture behind the drop, and then masked out the plane from around the drop, replacing it with a less obtrusive one.

 

Burgundy velvet: base: Blinn, Diffuse 0.5, Spec HSV 170 0.1 0.72, Rolloff and Refl 0, Ecc 0.51, Color HSV 350 0.95 0.7, optional bumpmap. Layer 1: Phong, Spec -0.7, Shinyness 3, Transparency 1. Layer 2 (top): Lambert, Diffuse same as base, Color same as base, Transparency mapped with sCloud, same settings as the skin layer below.

 

Here's a pearl shader, in 2 layers. The base layer is Blinn, Diffuse 0.36, Spec RGB 85/87/89, Rolloff 0.3, Ecc 0.337, Refl 0.58, Reflection mapped with sFile with a pic like this:

 

Color RGB 255/228/179, Incandescence RGB 18/14/9, (optional low amp. low freq. Water bump map), Translucency 0.17. A slight glow (Halo only, with no threshhold) is also nice sometimes.
To create a black pearl, use this base: Diffuse 0.093, Spec V 1, Ecc 0.283, Refl 0.4, same refl.map but RGBmult 0.3, Color 0.1, incandescence 0, translucence 0.4.
Top layer: Phong, Diffuse 0, Spec RGB 119/119/119, Shinyness 500 (to hide the highlight),Refl 1, Transparency RGB 188/178/161. Reflection map: Ball environment with image of mirror-ball raytraced in typical setup for shooting shiny small objects: white backlit tent or box with a hole for the camera (check photo-books or jewelry photos for reference). The original rendering is on the left, next is a version blurred (Gaussian in Photoshop, better than Bluroffset) for the Pearl shader, and last is a test rendering of the 2 Pearls.

 

Skin Shading

The most important material for the realistic character animator is skin, and the related materials of teeth, hair, eyeballs etc. But unfortunately, so far I don't know any software that can render skin as it really should look. These are the difficulties as I see it, in order of importance:

1. The fact that skin and flesh are extremely translucent, and that the top layers have a different color to the lower layers. (In real life transparency and translucency are closely related, but not in computer graphics.) Basically it works like a super-thin layer of white tracing paper on top of a thicker layer of dark red jello (for people low on melanin, like whites etc). Depending on the strength of the light, more or less will penetrate into the red (in sunlight roughly 4 - 5 mm down), bounce around and light it up. (Also, the teeth and the eyeballs are even more translucent than skin.) This has several effects: to make shadows lighter overall, to make the lit side darker, to decrease the range in the lit side, and to increase Saturation in the border between light and shadow. (Here I'm using the terms Saturation, Hue and Blackness or Value as they are used in the Alias and Photoshop color pickers.) Look at this image: here are two cylinders with a single strong light source coming from the left, one totally opaque like painted metal or concrete, and the other simulating flesh.

 

So on each we have the lit side, the border (terminator), and the dark side. On the opaque cylinder (the left one) we see a wider border, further to the left, and the lit side shows more of a gradation. Saturation drops at the terminator, and Saturation rises and Hue turns yellow in the highlight. (This is what cg skin quite often looks like.) On the "fleshy" cylinder we see a narrower border, further to the right and with a different distribution of its tones, with the lit side flatter, darker. Saturation increases and Hue shifts to red towards the terminator, especially in strong lighting conditions, and Saturation drops in the highlight.
You can see some of these effects if you look at a face with heavy makeup on it, or a latex appliance (as in movie sfx). All these details mentioned above are noticed by our subconscious, and we will never confuse skin with makeup, if we get a good look at it in strong light. (This is why the "invisible makeup" is such an elusive goal; any pigment applied to skin will lower it's translucency.)

2. Radiosity. Not being able to use a global illumination model to render skin contributes to the artificial feeling of it. Radiosity effects can be "faked" though, by placing lights or textures specifically to this end, if you have a fair idea of the effect you're trying to get.

3. The highlight. (Skin varies a lot from person to person, and even from one spot on the body to another, but let's focus on average healthy, young facial skin.) What gives us the very special, almost velvety, range of highlights that almost only human skin has, that makes us able to recognize it in blurry black and white photos? Translucency, yes, and apart from that, the texture, of course, but what exactly is it about it? I think "velvety" is a key word here - it is a bit like velvet, except the effect is less pronounced because where velvet has long regularly spaced and sized hairs skin has low regularly spaced and sized bumps (lets call it grain).

The grain also helps to increase the strength of the highlight a lot when the lightsource moves to almost face the camera. Try it with your hand - put a strong light behind you, look at the highlights on your hand (very faint now), then follow it with your eyes as you slowly turn around, until your hand is almost a silhouett. This effect calls for the Blinn-shader, of course, with Spec. Rolloff.

So what can we do to try fake all this? Luckily, Alias Power Animator has translucency capabilities... unluckily, not in a specifiable color. (Like using gray jello instead of red in the example above - if you try just making a nice skin color and then crank up the translucence, you'll get a grayish terminator, very ugly.)

But even worse luck, I don't use PA anymore, I use Maya. And Maya's translucence parameter is broken - it doesn't work at all.

So I cheat by using a bluish very wide highlight over a very orangey skintone: Blinn, Diffuse 0.7, Spec HSV 201 1 0.24, Rolloff and Refl 0, Ecc 0.68, Color HSV 21 0.74 0.9, Translucence 0.2, Transl. Depth 0.001 (depends on the scale of your model). This makes the shadow border "hotter" than both the lit and dark sides. Sometimes, for some scenes, using a slight reddish incandescence (but be careful not to get a glow in the shadows), and putting a reddish color in the spotlight's shadow color maybe. Experiment.

On it's own this puts a too orangey edge along the side closest to the highlight, so I add a layer that tones the saturation of the edges down: another Blinn, same Diffuse, Spec HSV 201 0.43 0.9, Rolloff 0.26, Ecc 0.35, Refl 0, Color HSV 21 0.2 1, Translucence 0.16, Transparency mapped with sCloud: Color1 0, Color2 1, Contrast 0.3, Soft_edges on, Transp_range 0.186, Center_thresh -0.465, Edge_thresh 0.53, Noise Amp, Ratio and Solid Noise Freq all zero (to make it smooth), Rgbmult V 1, Rgboffset V 0.3.

A good color and bump map helps a lot too - by that I mean a detailed specially painted texture map. Again, work from a photo or 3d scan if you can.

Careful - unless you do this next trick the bumps will only show up the lack of translucence and make the skin look like painted cement:

Add a copy of the bump map on a transparent higher layer, with a higher bump-value. Sometimes you can even leave out the lower layer of bumps and just keep the higher transparent one.

 

 

On the right is the same 2 skin layers with an additional layer that gives the effect of black nylon stockings, a Blinn with Diffuse 0.55, Spec V 0.1. Rolloff and Refl 0, Ecc 0.3, Color V 0.15, Transparency mapped with sCloud: Contrast 0.4, Soft_edges on, Transp_range 0.3, Center_thresh -0.14, Edge_thresh 0.5.

Now that you've gotten free know-how on this topic, try to grow your skills even faster with online video training. Then finally, put these skills to the test and make a name for yourself by offering these skills to others by becoming a freelancer. There are literally 2000+ new projects that are posted every single freakin' day, no lie!


Previous Article

Next Article


bala chandar's Comment
this is most usefull article thanks for your team
01 Tue Jun 2010
Admin's Reply:

Glad to hear that . Please feel free to exchange links to your works here.