5 methods of UVW box mapping in Blender 2.8X


Assalamualaikum. Hi guys!

My name is Widhi Muttaqien from Expose Academy.

I just published a video explaining 5 methods of UV box mapping inside Blender 2.8 or above. Box mapping is extremely useful for quickly applying textures on box-like 3D models without the need for manually UV Unwrapping them. This technique has been used as the primary UV mapping method in most architectural visualization projects.

I hope this tutorial can be helpful. Happy Blending! Regards, Widhi Muttaqien

Video transcript:

Assalamualaikum. My name is Widhi Muttaqien from Expose Academy. If you used 3ds Max before and you do a lot of architectural visualization projects. You might already be too familiar with the UVW map modifier. Especially with the box projection method. If you never heard about box projection mapping before. Well, basically, it is a method of applying 2D images or also known as textures onto the surfaces of 3D objects by projecting the texture from 6 different directions, top, bottom, front, back, right and left. This mapping method is very useful for quickly texturing box-like objects. And because architectural objects are mostly boxes. It becomes the favorite UV mapping method in the architectural visualization industry. Since 3ds Max version 2017, Autodesk even went further by introducing the “blended box mapping”. Essentially this new method can create seamless results on the projected images. This is the result of the ordinary box projection mapping. And this is the result of the new blended box mapping. You can see how the image at the projection borders has smooth or seamless transitions from one side to the other. This blended box mapping method can be extremely useful for texturing large objects such as terrains or anything that has a round shape.

So the big question now is, how can we achieve this in Blender? Well, Blender actually supports box mapping and blended box mapping in many different ways. In this tutorial video, I’m going to discuss several UV mapping methods that can produce box mapping as well as the blended box mapping. There are 5 methods that we are going to discuss in this tutorial. The first one is the UV cube projection method. Then the second one is the Magic UVW box mapping method. Third, is the internal generated box mapping. Fourth is the external generated box mapping. And finally which is my favorite is the UV project modifier method. Let’s discuss each of these methods one by one.

UV map cube projection

Probably the most common method of UV mapping when it comes to box-like projection mapping is the cube projection method. Basically, to do this, first, you need to select the faces that you want to apply the mapping to. Then press U to open the UV mapping floating panel. Then choose “cube projection” here. Blender will basically unwrap the model automatically so that the texture looks like being projected to the model from 6 different directions. If we open the “UV editor” this is the result of the cube projection operation. This method is very straightforward.

Now, let’s discuss the pros and cons of this method. The pros of this method are, first, the mapping is embedded into the object’s UV map channel. So if you export the model to external game engines or other 3D applications, the UV map will get transferred also. The second advantage is, you can rotate the texture easily either by rotating the vertices in the UV editor. This way, the texture rotation works locally only on this object as we actually rotate the UV map. Or if you need to rotate the texture on a more global scale. You can go to the material’s mapping node and rotate the Z-axis. If you are using UV as the texture coordinate. This XYZ rotational axes are actually U, V and W axes. So if you rotate the Z-axis here, you actually rotate in 2D space based on the normal direction of the face that receives the texture. The ability to rotate textures like this is very important. Because sometimes we have a good texture but the texture oriented vertically, for example, while we need it to be oriented horizontally. Or vice versa.

Now the cons of this method are, first, it is fixed or static. Not dynamic. Meaning, if you edit the model again later, perhaps you have revision from your client, the UV map will break and you just have to redo the UV projection process again. The second disadvantage is, it does not use a real measurement unit. Rather it uses relative size based on the face selection you have when performing the UV operation. For example, if you know exactly that the texture is 2 m square in size in the real world. You want the cube projection to be exactly at 2 m square size also. Well, with this method you can not do that. If you open the operator panel here. And change the cube size to 2 for example. Notice how the image is now repeated 2 times on each axes. So increasing the size value actually makes the texture smaller, not bigger. The last disadvantage. Because it is basically just a UV mapping method, it does not offer the border blending feature.

Magic UVW box mapping

The next method of box mapping is the Magic UVW box mapping. This is basically like the previous UV cube projection method but on steroids. To use this you need to turn on the “Magic UV” addon first. It comes bundled with Blender. So, just open the “preferences” panel. Go to the addon tab. Type “magic” here. And just make sure you have this checkbox turned on. Okay.

After you have the Magic UV addon active. If you select some faces, then press U again. You will get new options in the UV mapping floating panel. Go down here and choose UVW. Then choose “box”. Or you can also access this command in the sidebar panel. In the “edit” tab. Open the “UV mapping”. Then “UVW”, then choose “box” here. At a glance, it looks like the ordinary cube projection method. But notice if you open the operator panel, there is a size input here. This size input is in a real measurement unit. So if we type in 2 for example. The size of the projection mapping will be in 2 m square. Which is just awesome. So this is the first benefit of using the Magic UVW box mapping against the default cube projection mapping.

The second benefit is that it supports the use of non-square aspect ratio out of the box. If you use the default cube projection method, it always assumes that you have a square image. So your non-square image will get stretched or squashed.

Just for example. In this material, I use a non-square texture. To calculate the aspect ratio, you need to get the image width in pixel and then divide it with the image height. Now when we select the faces again. Press U and choose “UVW” then “box” command again here. In the operator panel, you can see the “texture aspect” input field. Just type in the aspect ratio of the image, and it is done. The texture now looks correct as the UV mapping adapts to the image aspect ratio. Now, I know that some of you might argue that we should control the aspect ratio in the material level, and not on the UV map level. Basically, you can fix the texture aspect ratio by changing the scale values in the mapping node. This is so we can use the material for other objects without having to worry about the UV map. Yes, this is true, but sometimes this feature can help us save time when we only use the texture on a single object and you don’t want to be bothered by creating the “texture coordinate” node and the “mapping” node.

So in terms of pros and cons. The Magic UVW box mapping method has all of the pros that the cube projection mapping has, plus with a couple more benefits. The only con is it does not offer the texture blending feature.

Internal generated box mapping

The next method is the internal generated box mapping. Unlike the previous 2 methods. This method and the next method after this are generated methods. Meaning, the UV mapping information is not embedded in the UV map channel of the object. Instead, it is generated procedurally on the fly. So you can have an object without any UV map channel with these methods. To use this method you need to create a material. Then add an “image texture” node. Choose any image that you like. Then in the “projection method” pull-down list, change the “flat” option here to “box”. Next, you need a mapping node and a texture coordinate node. These are the basic nodes that you need to control the image textures in Blender. I will assume that you already know about this. What you need to make sure is that you use the “generated” output here to control the mapping. Not the “UV” output. Now you can see the texture is projected to the object from 6 directions.

One great benefit of this method is that it supports texture blending. As you see now, the borders where the textures collide create very noticeable seams. If we increase this “blend” value. Look how the seam becomes more and more blurred. So that is how you achieve blended box mapping in Blender.

But, honestly, I almost never use this method in any of my projects due to the cons. So, the first disadvantage of this method is that the box mapping size is generated based on the bounding box of the object. Not based on a fixed size reference. So for example, if I create a cube here. Then apply the material. Just duplicate this cube. But for this cube, I want to edit it further. For example, I can go to the edit mode. Select this face and do a very long extrude. At the moment, it seems nothing is wrong. But once you go back to the object mode. The bounding box gets updated and so the texture now becomes squashed like this. So imagine if you have 2 furniture. One is a lounge chair. And another one is a sofa. You will have a long stretched texture on the sofa compared to the one you see on the lounge chair. This is because the sofa is simply longer in size compared to the lounge chair. And this is a big problem that no one wants to have in their rendering.

The next problem with this method is the texture rotation. As I mentioned earlier. Textures, such as wood, for example, are mostly provided in a single pattern direction. They are either oriented vertically or sometimes horizontally. When applying the texture to 3d objects. Some objects may need vertical orientation but other objects may need the horizontal one. So having the ability to rotate the texture in their local W-axis is crucial. Unlike the previous 2 methods that use UVW axes which basically a 2D or a surface coordinate system. The generated box mapping uses actual XYZ axes which are basically a 3D space coordinate system. So rotating the texture in the Z-axis, for example, will actually rotate the texture in the object local Z-axis direction. Which is okay if you only look at the object from the top direction. But not so great if you view the object from the side especially when you get to 90 degrees of rotation.

The last disadvantage of this method is that you can not export the mapping information to other external 3d software. Again, this is because the UV information is not saved inside the UV map channel of the object. Rather it is generated on the fly.

External generated box mapping

The next method is the external generated box mapping. Basically, it is the same generated box mapping as the previous. So it has the same pros such as the ability to do texture blending. But instead of using the object’s bounding box, it uses another object’s transformation to determine the size of the box mapping. So to do this, all you need to change in the “texture coordinate” node, is using the “object” output. Now, at this condition the texture is projected at exactly 1m size, regardless of the size of the object. And because it is projected on the fly, you can freely model your object such as adding extrude or just move the faces around. The texture projection will not break. Even if you go back to the object mode, the texture is always at 1m size. This is cool, but what we want now is a visual way to easily control the mapping. For this, we can create an empty object. Choose the cube type here as this is the best option for this kind of scenario. Now, when we look at the empty object’s property. It says size 1m. Well, this is not correct. This value is more like a radius than an actual dimension. So to make the empty object to be exactly at 1m size, you need to put in the half value of it. So type in 0.5 here. Now the empty cube object is 1m cubic size. Next, open the material again in the shader editor and click this eyedropper here and click on the empty cube object. By doing this, now the box projection mapping of this material is controlled by the empty object’s transformation. We can move this around. Or scale this to be larger or smaller. You can also scale this to just a certain axis to stretch the texture if needed.

But notice as I move this close enough to the object’s surface. The empty cube object doesn’t really align with a single texture placement. This is because it uses zero UV coordinate as the center. So UV uses a 0 to 1 scale for coordinate. This is 0, this is half and this is 1. If we want the center of the empty cube object to be at the center of the image, then you need to go to the mapping node. And in the location input fields. Select all of them and then type in 0.5. And that’s it. Now the empty cube object will be aligned perfectly with a single texture. This will give you better feedback on where the texture will be placed even if you are in the solid view mode.

In summary, with this method, we just solved the sizing issue of the generated box mapping. But the other problem with this generated technique still remains. And that is you can not rotate the texture on a certain axis without creating problems on the other axes. This is because we’re working on a 3D space, or the actual XYZ axes, not UVW axes. So for example, if you rotate the empty object in the Z-axis. Once you reach 90 degrees. It looks fine from the top view. But at the side areas, we get all this stretched texture. If we rotate this until 180 degrees we can see the side area back to normal.

UV project modifier

The last method of box mapping which is one of my favorite methods is the UV project modifier. Unlike the first 2 methods which basically just mesh UV mapping operations. Or the other next 2 methods which are generated method. This last method is different. It is a modifier that can alter the UV map channel of the object. It is like a “generated” method but uses a UV map channel at the same time. That is why it offers a lot of benefits from both worlds. Essentially the UV project modifier will assign other external objects as the projectors to project the textures. It uses the local negative Z-axis of the other object as the projection direction. So, yes, if you want to do a box projection mapping you need to set up 6 external objects as the projectors. Okay, you might be thinking to quit the video now imagining how cumbersome it is to set up the rig for the UV project modifier. But trust me, you only need to create this once in your lifetime. After that, you never have to recreate them again for the rest of your life. You can just append and or copy it over and over again. After you pass those difficulties, you have greater control over the texture projection.

Let’s see how we can do this. Create a sphere object at the center of the world. We need this mesh object as the container for the UV project modifier. Next, you need to make sure that the object has a UV map channel. By default, each mesh object created in Blender will have a UV map channel. If for some reason it doesn’t have any, just click on this plus button here to create one. Okay. Next, go to the modifier tab. “Add modifier”, then choose “UV project” here. In the UV map option, you can pick the UV map channel. But if the object only has 1 UV channel, you can just leave this blank as Blender will know exactly which channel to use. Here you can see the number of projectors. Again, for box mapping, you will want to have 6 projectors. For each of these projector input-fields, you need to select the object that will serve as the reference for projecting the texture. So let’s create those projector objects now. For this purpose, I prefer to use empty objects as they won’t show up in the rendering by default. So press Shift + A, then choose “empty”, and choose the “single arrow” type here. Let’s move this sphere object to the side, for now, so we can see what’s going on. Now, please be aware that although the arrow is pointing up, towards the positive Z-axis. The projection actually happens in the negative Z-axis direction, or this way downward. So this empty object is used for the top projection. Next, we need more of this empty object for the other 5 directions. Let’s just duplicate this one. Shift + D, then R, then X, then type in 90, then Enter. This is for the front projection. Next, Shift + D again, R then Z, then 90, then Enter. This is for the right projection. I will speed up the video now so you don’t get bored. Okay, now we have all of the 6 projectors that we need. But we haven’t named them correctly. Let’s rename the top one to “UVW-top”. Select the front empty object and rename it to “UVW-front”. And so on. I’m speeding up the video again as this gets too repetitive. Now we have all of the empty objects named correctly based on their directions. The last thing we need to do is to have another object as the parent for all of these projector objects. Let’s create another empty object, but this time we use the cube type. Rename it to “UVW-BOX”. Then to parent all of these projectors to the cube, select them all but make sure you select the empty cube object the last. So it becomes the active object. Then press Ctrl + P, then choose “object” here. Now we have the rig that we need. We can select the UVW-box object. And if we perform movement, or rotation, or scale, all of the projector objects will follow.

Let’s bring the sphere object back to the center by pressing Alt+G. Let’s rename this object to “UVW-project”. Open the modifier tab. And for each of the projector fields here you need to select the arrow empty object. So this is for the top. This is for the bottom. And so on. The order does not matter, as long as you list them all here and none of them overlapping or selected twice.

Now, for the material settings. Let’s duplicate the previous material so we don’t have to recreate it from scratch. Basically, you need to use common texture settings that use “UV map” as the texture coordinate. Optionally you can remove this object, or not. It doesn’t really matter as we are not using the “object” mode now. Next, set the location values back to their default which is 0. You can do this easily by hovering on one of the axes fields and then press Backspace. And finally in the image texture node, in the projection mode, you need to use the “flat” option again. And that’s it we’re done.

Now I can control the texture projection by moving the empty cube object around. I can also do scale uniformly or non-uniformly. And in terms of rotation, this is where this method shines against the other generated methods. With this setup, you can rotate the texture in 3 different ways. First, you can rotate the empty cube object without resulting any stretching issues. Even if you rotate it to 90 degrees, the mapping won’t break. Second, you can rotate each of the sides independently from the other sides. To do that you can grab any of these empty arrow objects. Remember that each of these arrows has the local Z-axis pointing at the center. So to rotate the texture you can press R and then press Z twice. You can see the texture at this side rotates without affecting the other sides. The third method of rotating the texture is via the mapping node of the material. This will rotate the texture at a global scale and so will affect every object that uses this material. Because the UV project modifier uses the UVW channel of the object. These XYZ axes you see here are actually UVW surface axes. So to rotate the texture along the surface you can simply use the Z-axis here which is actually the W-axis. As you can see the texture rotates globally using this method.

Another benefit of this method is editability. Although it uses UV map channel, it is also a live projection method. So you can go to the edit mode and just edit the object without any worries. You can extrude or move the elements around. The texture mapping will not break as it is constantly being projected. And lastly, one of the pros of this method is you can export the resulting UV map to other 3D applications. Well, of course, you cannot just export it with the UV project modifier attached. You need to apply the UV project modifier. By doing that, the UV mapping information will be embedded in the UV channel of the object. With this if you export the model in a 3d format that supports “UV channel” such as FBX, or GLTF or OBJ for example. The UV mapping will get transferred also.

There is one caveat though with this method. Unlike the generated method, this method does not support blending. So again, if you need blended box mapping you are better off with the previous external generated box mapping method.

How to apply the UV project modifier quickly

As I mentioned earlier. Although the UV project method seems too troublesome to set up. You only need to create it once in your life. After that, you can just reuse it again and again pretty easily. Let’s see how we can do this. First, make sure that you have the empty arrows and the empty cube and the mesh object that houses the UV project modifier set up like this. You also have named them correctly. Then just delete the other unnecessary objects in the scene. Also, you can just remove the material from the mesh object. After that save the file and name it to any name you like. I’ll name mine “UVW-box-project-template”. Click “save as” here. Now you have a template file where you can append the UV project rig.

Let’s see how we can append the rig from another file. Let’s say you open another file or start a new file. And in this file, you have this large wall object that you want to apply a UV box projection mapping to. To do that, go to the file menu, then “append”. Then choose the template file we saved before. Open the “object” folder. And just choose all of these objects. Click append here. Let’s move this to the side. What you need to do now is to transfer the UV project modifier from this sphere object to the wall object. To do that, select the wall object. Hold shift and then select this sphere object. So the sphere object is now the active object. Then press Ctrl + L. This will open the “make links” floating panel. Choose “modifiers” here. Now if we select this wall object, it already has the modifier and all of the projectors that we need are already assigned. At this current state, you can delete the sphere object. But you may want to keep this in case you need to duplicate the rig later. Let’s add a texture for the wall object just to see that the UV projection does work. For example this one. Use the material preview mode. As you can see, if I move the empty cube object here the texture follows accordingly.

Now the next question is, what if we need more than one rig. Let’s say you have another object here. And you want to use a different UV project rig. Well, you can solve this easily by appending the objects again from the template file or just by copying the existing rig here. Blender will take care of the objects naming and linking process for us automatically. So for example, select these whole empty objects by creating a region selection like this. Or, because the arrows are parented to the cube. You can select only the empty cube object. Hold Shift and then press the closing bracket. This will select all of the children of the currently selected object. Then hold Shift and select this mesh object that has the modifier attached to it. Shift + D to duplicate and just move them to another location. You can see that the new empty objects have numbers after their names automatically. And if you select this mesh object. You can see it already has the modifier attached to it and the names of the projectors are automatically pointing to the new empty arrows. Which is nice. Then just like before, select the object, hold Shift and then the sphere object. Ctrl + L and then choose “modifiers’ here. Now if you apply a material with a texture to this object. We can control the texture by transforming these empty objects. This rig here is independent from this rig here.

Okay guys. If you want to learn more about computer graphics. Perhaps you want to jump into the video game industry. Or perhaps you want to create digital assets that can generate passive income. Or you want to have a career doing something you really love. Or become an entrepreneur in the creative industry and build your own design firm. Or maybe you just want to learn CG as a hobby. Then you should check out my courses at Udemy or at Skillshare. The links are in the description below. Currently, I have courses in Blender, 3ds max, Photoshop, Adobe Illustrator, and Krita. And more to come -in sha Allah-. All of these courses will guide you from the very basic, step by step, until you can master the skills that you need. As always, subscribe to my channel. Share the video. Give a thumbs up if you like the video, and give a thumbs down if you hate the video. Check out my other tutorials. Wassalamualaikum.