Wednesday, June 23, 2010

Displacement mapping in the world of the very small

Male nude art ... 3D an' all --! You thought today's post was going to be about the joys of displacement mapping, and you'd be right, but I thought I'd set the scene and get into the right environment first. Or at the very least get everyone's attention with a lovely male nude!

So, mission accomplished! And after getting your attention, I'll feel at liberty to get on with what I promised:

Displacement mapping. What the heck is it, why bother doing it, and if you decide to do it, how?!

The best way is to "show, not tell," so doing this in pictures was the only way to go. All of the following images have been uploaded full size. The effects I'm talking about won't be visible in the reduced-size shots Blogger pastes up, but if you click on the pictures they'll pull up at 1:1 size, and you can see the whole deal. Here goes...

Long shots are more or less plain sailing. You're not close enough to individual objects and surfaces to be able to see if they're plastic-smooth or if they have the visual texture you expect of real objects, but...

Closer shots start to show surfaces. By the time you get as close as this to the wall in the above image, you'd start to notice it was plastic. What you need to add in is a texture that either makes the surface of the 3D model in the image rough, or at least makes it LOOK rough. Luckily, there is such a thing, and it's called a displacement map. Now, to make the difference obvious between surfaces are are displacement mapped, and others that aren't, I put the mapping on the walls, above, but not on the rocks. Aha! So...

Let's drive the camera in even closer and get right up to the rock. It starts out as a gray plasticky lump -- this is the OBJ "object" that loads right into your program. Then you put a JPEG texture map on it ... most likely a photograph of a rocky surface. This wraps around the OBJ, so that from a distance it looks like rock. But close up, it looks like the rocky texture was an image (which it is!) printed on a plastic surface. What we need to do is rough-up the surface of the rock, make it less smooth...

Same image with the displacement map added to the rocks and pebbles and even the ground. Whoa, what a difference. Now, it looks like you could get right up to the boulders and touch, and feel the roughness. And you can keep on adding this effect ... let's drive right up to one of those fantastic mushrooms (they're Mykos, by Poisen, from Renderosity)...

No displacement map on the mushrooms in this shot. Then I add the map...

Click to enlarge this -- the displacement map makes a big difference, but the miniaturization of the Blogger upload makes it hard to see. What a difference!

So, what's a displacement map anyway? Like bump maps, they're mostly black and white images, where true blacks made the surface of the object get punched in, and true whites make the surface get pushed out. And if the maps are grayscale, you get a continuous gradient between the two extremes. Unlike bump maps, displacement maps actually do deform (rough up) the surface of the object. Bump maps just give the illusion of roughness. I don't usually mess about with bump maps, because the illusion goes away if you turn the object sideways on, and suddenly you can see it's still smooth.

Okay, so far so good. What's a displacement (or bump) map LOOK like?

Well, one could easily look like this:

(Have this one on me -- take it home and play with it. It's okay for me to upload it and give it away, because I made it myself. Anyone gives you grief about this, tell 'em to talk to me.)

That displacement map will cause a surface to ruck itself into the textures of a piece of malachite. How did I make the map? I got an image of malachite, opened it in Irfanview and reduced the number of colors in it to ... two. Then saved it. Only black and white left there, so you have very deep striations and no gradients. Like worn and pitted old rock. Have a look at the closeup of the gargoyle in this post from a few days ago. Same effect, achieved the same way. I think it was even this displacement map I used to do it.)

So far, so good. You can see what displacement maps can do. You could also choose to set the same map as a bump map -- it'll just created the illusion of roughness, rather than the real deal. You've got a map to have a play about with ... and you know how to make them. So, how do you apply them?

This is the part that I can't actually be totally explicit about for every reader -- I use DAZ Studio 3, Bryce and 3D Studio MAX ... you might have chosen to learn this work in Carrara, Maya, Blender, Terragen, World Builder, iClone, or any one of a dozen others, right? So I can only point you in the right direction.

In DAZ, you need to open your Surfaces tab. In Bryce, it's under the little [M] Materials tab on your little floating toolbox. In MAX, it all happens in your textures editor. Open whatever toolbox or tab or menu, and look fot where you get your options for "mapping."

Now, there's loads of different kinds of mapping: bump, displacement, reflection, refraction, transparency (aka opacity), specularity and ... on and on. Don't worry about the rest. Ignore 'em till their times comes. Zero in on bump and displacement, and in the popup dialog, click through to where you saved your map. Apply it ... and don't forget to "dial up" the strength of it. The effect can be adjusted from barely there at all, right through to the point where it'll turn an egg into a hedgehog. Experiment till you get what you need ... if it turns out you don't want the surface deformed and the illusion is what you need, switch to bump mapping -- use the same map. Enjoy!

Jade, 24 June

Related Posts with Thumbnails