Say I want to apply some dirt to a bunch of objects in my scene. While
I could use procedural noise, I'd prefer to use bitmaps since that will
make the dirt will look a little more organic. But I don't want to
spend a long time setting up good UVs for all of the objects, because
that will take awhile. This is a tutorial that discusses a quick and
easy way to apply a noisy
bitmap to a bunch of objects without the need to unwrap their uvs. The
technique is called a Blended Box Map, or also sometimes referred to as
a Triplanar.
What is a Blended Box Map?
So lets start with 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.
As already mentioned, one way is
to unwrap your object's uvs. But this can take
awhile to set up, especially if you have lots of objects in your scene.
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.
Lets look at the same problem on a sphere with 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.
If only there was some way to blend the seams on a box map?
That's where a Blended Box Map comes in. It's just like a regular box
map, projecting the material from 6 different directions, but blends
the seams so you don't notice them.
Here's a practical example, a robot character, which is
made up of 291 separate objects...
and I want to apply some noisy dirt to
all the pieces.
That's gonna be a pain to uvmap all those pieces of geometry, so lets
use a Blended Box Map instead.
Assign the noisy bitmap above to a Blended Box Map instead of a regular
box map, place it into the diffuse slot of a material
assigned to the robot so you can see the result...
Looks the right size, and no visible seams. Now lets place the Blended
Box Map in the mix slot of a blend material to
blend
between a
metal material and a dirt material. White parts of your map will show
the dirt material, black areas will show the metal material...
So there, I've added some dirt to 291 objects in just a
few button clicks, no tweaking procedural parameters, no uv unwrapping.
There are many different ways to make a Blended Box Map...
The best Blended Box Map is now built into 3dsmax 2017 Ext
1. It's called BlendedBoxMap and can be assigned as a map to any part
of your material.
Here's a video showing the process for using 3dsmax 2017's
BlendedBoxMap.
SoulburnScripts
Blended Box Mapping Using UVWMapping Technique
The SoulburnScripts technique is a manual way to
construct a blended box map using the 3dsmax base package and works in
all renderers and versions of max prior to 2017. The
trick is to apply 3 planar UVW
Mapping
modifiers
using 3 different map channels to your objects, and then blend their
edges using
falloff maps.
Take a peak at the map tree...
And a look at the 3 uvw mapping modifiers...
Also note, in the output section of the 2 falloff maps are curve
controls, and modifying these curve controls achieve a sharper or
blurrier
transition on the edges.
And here's 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.
So rather than manually creating the map tree and applying the uvw
modifiers, I've automated the process and wrote a
maxscript that will make the map-tree and UVWMapping gizmos for you.
Please visit my Soulburn
Scripts for 3dsMax page and get the latest pack. Install
the scripts, and run the script called blendedBoxMapMaker. Here's an
interface snapshot...
To run the script, select the objects you want to apply the 3 UVW
Mapping Modifiers to, in the script interface window choose Create Map:
"Falloff Method" and Create Mapping Modifiers: "UVW
Mapping
Method", choose the bitmap you want to use for your blended box map,
and
hit "do".
It'll apply the modifiers to the objects...
And place the map tree into your chosen slot...
Here's a video showing the process above for applying a Blended Box
Map to the robot head using the SoulburnScripts
Blended Box Mapping Using UVWMapping Technique...
SoulburnScripts
Blended Box
Mapping Using
Projections Technique
First off, you will need the free plugin CameraMapGemini v0.16 or
higher by Markus Boos (http://www.projectgemini.net/CameraMapGemini/).
Install the plugin, and run max. Now go back to the blendedBoxMapMaker
script I showed you in the last section and change the "Create Mapping
Modifiers" mode to
"CameraMapGemini Method".
Run the script, select the robot, and notice a few changes.
First, instead of applying 3 UVWMapping modifiers, it applies a single
CameraMapGemini modifier to your object, and creates 3 projection
cameras.
These cameras will project your texture, much like how the UVW Mapping
modifiers did, except the cameras are not attached to each separate
object. Decoupling the projection position from
the object position means no more misaligned projections. And if you
need the projections to move with the objects, just parent the camera
projection group (a point object seen in the above image in aqua) with
the parent of your geometry hierarchy. Now whenever you
move your whole robot, the projection cameras will move with it, and
so the projection stays attached to your objects.
Now check out the CameraMapGemini modifier assigned to your objects...
Notice the modifier references your three projection cameras. But since
there's only a single modifier, adding new objects to your robot is
easy, just copy and paste an instance of this modifier to your new
objects.
The visual results of the CameraMapGemini Method provides identical
results to the UVW Mapping
Method...
What's the best choice between
the SoulburnScripts
Blended Box Mapping Using UVWMapping and SoulburnScripts Blended Box
Mapping Using
Projections Technique?
The main advantages of using the UVWMapping Technique over the
CameraMapGemini technique are...
CameraMapGemini doesn't work in mentalray.
CameraMapGemini doesn't work in VrayRT.
CameraMapGemini doesn't support bump mapping (if you're using
vray, you can run the result through a color2bump map to get bump map
results).
CameraMapGemini takes a little longer to render than the
UVWMapping method. I've seen a 2x slowdown rendering objects.
You're dependent on a 3rd party plugin, rather than the UVW
Mapping technique that uses tools that already exist in max.
The main disadvantages of using the UVWMapping Technique over the
CameraMapGemini technique are...
The mapping
modifiers are attached to each individual object. So if you move one of
your objects, the mapping modifiers will become misaligned.
Your objects need to have their transforms reset in order to get
the falloff maps to align properly with the world (this is done using
the Reset XForm utility in max). This is especially
bad if you want to keep your original transforms on the objects.
Adding a new object to your mapping requires copying and
pasting three separate mapping modifiers, and in the process of pasting
them, again, they may become misaligned.
Here's an example of mis-alignment. I decide to move one of my bolts on
the air vent on the robot AFTER I have set up a Blended Box Map using
the "UVW
Mapping
Method". Since the UVW Mapping Gizmos are attached to my objects,
moving
the bolt moves just one of the gizmos. Now I have multiple gizmos in
multiple locations in 3d space, instead of them all being nicely
aligned.
Note: There is also a "CameraMapGemini Method" under "Create Map". I
highly recommend not using this method, as it has a number of bugs.
Stick to "Create Map: Falloff Method" and "Create Mapping Modifiers:
CameraMapGemini Method".
In general, if you're going to use the Soulburnscript for your blended
box mapping, I would recommend using the "UVWMapping" Technique, as it
has the fewest downsides. But the
other technique is there if you need them.
VrayTriplanarTex
Vray recently added a triplanar texture to version 3.3.
Here's the interface...
It's simpler than the one built into 3dsmax 2017, but is available for
older versions of max, and is far better than the soulburn scripts
methods.
Here's
a few notes on
what the parameters do...
Texture is the bitmap you want to use in your box map. You can
specify using the same bitmap for all 3 directions (most common), or
apply a different bitmap to each direction.
Scale is the size of your blended box map. A value of 0.01 means
your bitmap will be applied 100 units square inside your scene. So if
you have a 100 unit box, it will receive your bitmap a single time. The
one downside for this blended box map being a texture map only is
there's no visual in the scene of how big it is, you have to render to
see how large the pattern is.
Blend is how blurry the edges are, 0.1 - 0.5 is good for most uses
Frame Offset: This controls the middle point of the blended box
map. So if you want to move your entire pattern to the side a bit, you
can do that here.
Texture Rotation, this allows you to rotate the texture on each
axis. I have found that if you leave this to 0,0,0, you sometimes see
repeating textures. My preferred defaults are 0, 35 and 70, this
produces more random looking results.
Space: Local space means the box map is transformed based on the
transform of the object. That means, the center of the map will be
applied to the center of each object. This can lead to some odd looking
results if you have a lot of objects...
In these cases, I'd recommend either attaching more of your
objects together into a single object, or use "Node space" instead. To
use do this, group your objects
by linking them to a point helper (which is generally a good idea to do
anyways), then choose the point helper as your node, and now the
pattern will flow over your objects properly as though they were a
single unit, even though the objects are actually separate.
And note, if you choose node but leave the reference node slot
blank, it'll default to world space
Random: these are ways to have the pattern randomly transformed
on every objects its assigned to.
So why use this method instead of the Soulburn method? A number of
reasons...
Doesn't need UVWMap modifiers applied to objects. This means you
can easy assign the material to a new object and you don't have to
worry about copying UVWMap modifiers to those objects, and that speeds
up your workflow.
Renders Faster
More compact in the material editor: In your Slate Material
Editor, this technique has 2 nodes connected to each other, instead of
7, which makes your material easier to read
No reset Xform necessary. You can assign
the material to objects that don't have their transforms reset.
However, I'd recommend resetting the transforms of your objects anyways
since you'll get more consistent looking results.
Of course, it has a few disadvantages...
Requires vray
Harder to visualize the size of your pattern in the viewport
since there's no mapping modifiers, you need to render the pattern.
A huge thanks to Vlado for writing this.
InstantUV
As a footnote, back in the
earlier days of max (Max 4) 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.
Here's a screencap from Robert Seidel:
Triplanar
in Mari
Mari recently (2012) added a new feature called triplanar that does the
blending we're after, but since Mari can only export texture maps in
the end (and you'll need to spend time Uving your objects), you can't
go in after the fact and change parameters to your
box map in your 3d app once you've baked your final textures.
Triplanar in Substance
Designer
Substance Designer also has a TriPlanar, but it also requires baking
the result into a bitmap with UVs.
Further Reading
Go here
if you'd like a way to make a Blended Box Map in for Maya. And here's a
script
that helps to automate the process.
Visit here if you
want to see a 30 min tutorial on how to setup a Blended Box Map
manually
by Paul Neale, it explains a lot of the nuts and bolts behind how the
process works, although for making BBMs I would stick with my script
since its a lot faster. But always good to know the theory behind what
you're doing.
Anyways, hopefully you see the advantages of using this technique over
unwrapping thousands of objects, and you can incorporate it into your
workflow, choosing the best Blended Box Map for you.
Triplanar
in Blender
So when I tried out Blender, one of the first things I wanted to know was how to achieve the Blended Box Map result. Thankfully, it does have the feature, and so this short tutorial will show you how to do it.