Artisticrender is supported by its audience. When you purchase through links on our site, we may earn an affiliate commission.  Learn more

Erik Selin
Erik Selin

3D artist & all that other stuff

Share on facebook
Share on twitter
Share on pinterest
Share on reddit

Blender box mapping workflow, a quick look

If you are like me, you are lazy. Making a UV Map for every object takes time and even if I am still sitting in my chair while doing it, it involves an internal meltdown. At least for me. Sometimes. Box mapping to the rescue!

Box mapping is a way to project a texture onto a 3D object without a UV map. We project the texture from 6 sides, XYZ and their negative counterparts. Box mapping is often called triplanar projection. To use box mapping for a texture in Blender, select the image texture node and change projection from flat to box. Use a texture coordinate node with generated or object coordinates connected to the vector slot.

What is box mapping?

With box projection, we project the texture from six sides. Positive and negative X, Y and Z. In the UV map we can tell what pixels the faces (polygons) should have projected to it, but in box project mode we are limited to the 6 sides of projection. What we sacrifice with box projection is control, but what we gain is speed, lots of speed.

In a way you could say that box projection is a good effort to make an image texture a procedural texture.

When do we use box mapping?

Box mapping or trilinear projection as it is also called is not suitable for every type of 3D model. But one area where it excels is architectural visualization and interiors. The reason for this is that there is a lot of objects that are quite square, and we can box project our texture on to those objects, make some adjustments and be done.

How to use box mapping?

We have two different kinds of textures that we will consider. An image texture that is seamless and is quite uniform, meaning there is no clear direction as to how the texture should be laid out. This could be a moss or rock texture. The second image texture is also seamless but it has a clear direction to it. Like wood.

Let us first look at the uniform type since it is the simple one.

Start with a texture coordinate node and a mapping node. Use the generated or object output from the texture coordinate node and pipe it to the mapping node. Generated and object coordinates works differently but for our intentions here they will serve a similar enough purpose.

Pipe the mapping vector output to an image texture and change the image texture from flat to box. Now you will get a blend value that you can raise to blend between the 6 angles the texture gets projected from. For a rock or mud texture a value around 0.2 or 0.3 usually gets rid of any seams that might have been.

Image note: Arrows should be pointing at object, not camera

This is as simple as it gets for box projection.

The tricky part is when we come to the second type of texture where we have a clear direction that absolutely needs to be rotated correctly. If you try to change the rotation value in the mapping node you will get less than ideal results in most cases. Here we have two options. Let’s first look at the rotate image option.

Use a 2D image editor or an add-on

We can either rotate our texture in a 2D image editor and save a rotated version and use that in the same way as we did with the uniform texture. For this, I have written an add-on that can help. It has two functions. The add-on is made for Blender 2.80 and is available here:

Boxtoggle tools (Direct download)

Install it like any other add-on. Go to edit -> user preferences, find the add-on section and click install. Browse for the add-on zip file on your hard drive and chose it. Check the checkbox next to the add-on name once it appears in the list. Close preferences and open the shader editor to start using it.

The first operation is a toggle between box and flat image texture projection. When toggled to box project the blend value is set to 0.2. This is just to speed up the process of toggling multiple image textures to box project at once. IT helps if you have PBR materials with hoards of different texture maps.

Select the image texture nodes in your node tree that you would like to toggle. Hit alt+q or hit space and type “boxtoggle” and hit enter to use this function.

Ok, now for the tricky rotation stuff. This will give us some control, but not full control. The second operation will rotate the image texture that is set for any selected image texture nodes. Use it with alt+w or search for “rotateimage”. How does it do that, well it looks for an existing rotated image or makes one.

Let’s say that we are trying to box map “my_cool_wood.png” to our object. When we run the “rotateimage” operation Blender will look inside the blend file if an image called “my_cool_wood_rotated.png”. If it finds it, it will switch to that image.

If Blender can’t find the image it will look in the original folder on the hard drive for “my_cool_wood.png” and see if there is a “my_cool_wood_rotated.png”. If  the image is found there, Blender says, “great!”, to itself and loads in the texture. If the rotated version still can’t be found it will just be created and stored in the original folder on disk.

Now the rotated version will definitely exist and the next time you run the operation Blender will just toggle between the rotated and non rotated version of the image.

This gets us some more control. We get to rotate all projections by 90 degrees at the same time. But we still can’t rotate every projection angle individually.

Solve the problem with a node group

The other method is to use a node group. The math behind this node group was made by MartinZ on blenderartists and the node group was then put together by Nathan_boder. You can read the full forum thread here. However, the download links seems to be broken. But you can get the blendfile here. You need 2.80 or later to open it. A 2.79 version is available from the thread above.

Append all node groups from the file. Use the node group called “texture preferences” instead of the texture coordinate node and pipe it straight to your image texture. This node uses the flat projection method so change from box to the default flat. Notice here how we lose the blend slider when we use this method. This is one of the drawbacks. The seams that might be however, may not be so obvious and if this way of texturing can save us UV Mapping and still gives us enough control, then we might have saved ourselves some time. 

To learn how it works setup it up in the shader workspace to see how the texture behaves as you change the values in real time.

Putting it all together

So, how could we use all this to our advantage? Well, this is my approach. First I determine if my model is fit for box projection or if I need a UV Map. Most of the time I will go with a UV Map starting with a Smart UV Project but if my model is simple enough or unimportant enough I will go ahead and try box project first.

You can read more about UV Map workflow in my article The definivive guide to UV Mapping. It is a long read though, but it might help you understand different workflows of  mapping, why we UV map and what aim you should have for your UV-map in different situations.

Then I will select all image textures that I want to box project and use the Boxtoggle add-on above. I inspect the projection and see if it fits my needs. If not I may rotate the images using the add-on if it is the rotation that is the issue or just adjust add a mapping node and adjust the scaling if that seems to be the problem.

If I am still not happy I will delete the texture coordinate node and use the node group from the blenderartists thread above. From there I adjust the parameters as I see fit.

In case I am still not happy with the mapping. Maybe I need different rotation and scaling independent of the projection angle for instance. Then I will go back and walk through the appropriate UV Mapping workflow.

This may seem like a lot, but all this is probably done within the minute if Blender is set up correctly. Toggling box projection is super quick with the add-on, same with rotating the image. Switching the texture coordinate and mapping for the node group above is also seconds away. We are simply moving from the simplest and fastest to the more complex method as we may discover limits we may or may not tolerate in our scene as we go.

Final thoughts

We learned how to use box mapping and that it can also be called triplanar projection in other applications than Blender. We also looked at increasing our control over how the mapping is done by rotating and scaling in different ways. Either using a rotated image quickly made with the add-on above or through a node group. With the node group though we lose the blend value but the rotated image approach can’t rotate individual projections.

I hope you found this useful and I would like to encourage you to share this on your social media channels as well as commenting if you have any questions or feedback. It really helps out a lot. It motivates me and also helps others.

Also consider joining the newsletter. I don’t send regularly and not very often. Instead, it comes as a friendly reminder from time to time that I am still here, making your 3D art life just a little easier every time you come around to read a bit more.

Thanks for your time

Get our free workflow cheatsheet!

Join our newsletter and get updates of our news and content as well as our 3D modelling workflow cheat sheet.

More to explore

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.