Blended Box Mapping
By Neil Blevins
Created On: May 15th 2006
Updated On: Feb 26th 2007
This is a tutorial that discusses a quick and easy way to apply a noisy
bitmap to an object without the need to unwrap the uvs of the object.
Say you have a reasonably random and noisy bitmap like the following...

And you have a somewhat irregular object like this...

And you'd like to quickly apply this pattern to your object.
One way is
to unwrap your object's uvs. This will let you apply a very specific
patterns to your object without stretching or seams, but it can take
awhile to set up, especially if you have lots of objects in your scene,
and is overkill for a lot of situations.
A quicker way would be to use
box mapping on the object. Box mapping is a mapping type that projects
your texture from the six sides of a box at your object. So apply a UVW
Mapping modifier to your object, set the mapping type as box, and
render...

Well, that sort of worked, except there's a bunch of bad seams. Why is
that? So
if you use box mapping on an object that has rounded corners, faces of
your mesh that point towards one of the 6 sides of the box map work
fine. But if a face is near a 45 degree angle to the sides of the box,
you get a seam where different sides of the box apply mapping to each
face. For example, say a face is 44.5 degrees away from the front of
the box map, it will receive mapping from the front of the box. Now say
the next face is 45.5 degrees away from the front of the box map, it
will receive mapping from the side of the box. So between those two
faces you get a seam.
If only there was some way to blend this seam. Well, back in the
earlier days of max there was a plugin called InstantUV that did this
sort of thing. But the developer decided to stop selling it, and it
never got recompiled for more modern versions of max. But there is a
trick you can use with standard max tools to do something similar. It's
a bit of an ugly hack, and takes a little time to set up, but notnearly
as much time as it takes to unwrap a ton fo objects. We're going to
construct our own box map, but with blended edges.
Lets look at the same problem on a sphere.

Instead of a noisy map, this is a custom uv map applied using regular
box mapping. Notice the seams right at the edges where faces are near a
45 degree angle to any given side of the box map.
The way to get rid of this is to apply 3 planar UVW Mapping modifiers
using 3 different map channels, and then blend their edges using
falloff maps. Ideal would be an addition to the UVWMapping modifier
that did this setup for you automatically (with a value to control the
sharpness of the blended area), but since we don't have that, we're
gonna have to do it the ugly way.
Take a peak at the map tree...

And a look at the 3 uvwmapping gizmos...

Complex, I know. But grab this max
8 example file, and now just copy and paste the 3 UVW
Mapping modifiers from the object in the file to any new object you
want, and then copy the material, and you're all set. (Note, for best
results keep the 3 planar mapping gizmos square, like in the example
above, all planar maps are 66.332 by 66.332 units square.) You can also
try the blendedBoxMapMaker script that I added to the
tools page, which automates most of the process of creating both the
maps and modifiers. Give it a shot.
Now take a look at the results...

Notice the blending between the edges. Now this isn't ideal for
something with a regular pattern like this uv map, but lets go back to
our original example of the noisy looking map...

The seam is basically gone (if you look real close you can sorta see
it, but
3d is all about illusion, if the viewer can't see it on first read then
it might as
well not be there). And remember, the noisier the map is, or the more
box-like your object is, the better this will work. For example, a lot
of the skin texture in this image was done using this technique.
Also note, in the output section of the 2 falloff maps are curve
controls, modify these curve controls to achieve a sharper or blurrier
transition on the edges.
I also use this technique for adding dirt to objects. I rarely use
procedurals for dirt maps since bitmaps tend to look more natural, but
don't always have time to do a full unwrap and paint separate dirt maps
for all the objects in my scenes. So I'll use this technique to apply
dirt bitmaps to the surface of an object quickly.
Also in the max file above is a slight variation, a 6 sided blended
box map.
This is similar to the 3 sided one, except it now takes 6
distinct maps (top, bottom, left, right, front, back) instead of just 3
(top/bottom, left/right, front/back). This will allow you to apply 6
slightly different patterns should you need it. Or if you need just a
single pattern repeated over the entire surface, use the 3 sided one.
This site is ©2007 by Neil
Blevins,
All rights are reserved.
Back to NeilBlevins.com