Generated Mapping and Texture Space


In a nutshell: use Shift+T, G, S and axis constraints to move and scale the Texture Space and position a tileable texture with Generated Mapping. Find precision Texture Space settings in the object data panel.

Long version: generated mapping sounds a bit simple but simple is beautiful and most important, useful.

This is the default Blender mapping mode, so if you add a texture to an object you’ll find it’s already set there in the mapping panel, just change it to “cube” if your object is more than a floor and has any vertical surfaces.

The Generated mapping projects the texture onto the object from a rectangular box in 3d space, so a good use for Generated mapping is any architectural building part that has a standard orthogonal shape, or even some slight non orthogonal faces if the map doesen’t get much noticeable distortion when projected at an angle. Some wood grain for instance can stretch a bit without looking wrong.

The small house clad in wood I’m working on now  it’s a fairly standard example of an architectural mapped object. I want to use a wood siding texture from cgtextures. I just edited it a bit to get rid of a couple of visible contrasty details in the wood which would have made the map repetition obvious. I want the wood to align nicely with the upper and lower part of the windows. I also made a separate object around the big corner windows for some light tricks I want to try, and I want this part to have the same scale and alignment with the rest of the walls.

Now to the best part, the hidden secret of generated mapping in Blender: Texture Space. This is a hidden box assigned to each object, the size and position of which determines the placement of the texture. The “generated” term comes from the fact that each object starts with an auto generated texture space, aligned to the 3dspace global coordinates, that is the same as the object bounding box. To make it visible you can press shift+T or check Texture Space in the Object tab -> display. A dotted line box will appear. Texture space can then be adjusted to fit your texturing needs.

The methods for handling the Texture Space box could be better. You can feel somehow that this part of Blender has been a bit unloved. But you have just enough control over it to get neat results. To move and scale it interactively you press shift+T, then G or S. You can also use axis constraints. To scale it on the z axis you go like this: Shift+T – S – Z. Unfortunately you can’t correctly see your texture in the viewport except in flat mapped objects like floors, with the SGSL display option, for cube mapping you’ll have to render to check the results. However, I know exactly where I want my texture to be, so I will scale and place it in wireframe mode, like this:

To map the second object I can scale and move it’s texture space like before until it matches the first object’s texture space. But maybe I need to do this in a more precise way; for instance, if two objects meet at an edge, any small misalignment of the maps will show. So for this I will use the settings in the “Object data” panel -> Texture Space (you won’t believe how much time it took me to notice this settings existed!) – where you can exactly adjust the size and position of the Texture Space box.

To get the same mapping I will copy/paste the settings from one object to the other.

Unfortunately I didn’t find a  direct way to copy all mapping settings from one object to the other, I just copy-pasted them one by one. To  make it a little better I opened a text window on the side and copied all numbers from the wall object first, so at least I won’t have to jump from one selection to the other six times.  A  small addon to copy texture space coordinates between objects would be a neat idea.

I also tried to figure out the texture mesh option in that panel but  couldn’t understand how it works.  Setting a different mesh as  texture space input looked in my test same as auto texture space.  Would be happy if someone had some idea on this.

Back to the subject, this settings can also be used to scale a texture to match the exact proportion of the map or to scale a texture to real size, for instance a floor covered in 30×60 tiles, without having to make other calculations.

So here is the result, all wood aligned as intended:

You can spot the tiling if you look closely but I think it’s OK.

Other points on Generated Mapping:
There is just one texture space for every object so if you want to mix textures scaled differently you can position one with the texture space, the other by changing the repeat and offset settings. For instance you can use a large map with some dirt on the auto texture space and use repeat on the actual cladding texture. Didn’t try this but I think you can mix Generated mapped textures with UV mapped textures – to get a graffiti on a brick wall or instance.

There is a related mapping method that sounds good – Object mapping, which takes another object’s mapping coordinates so you can adjust the mapping by changing that object. I tried hard to use it before discovering the Texture Space thing but I got really buggy results, like one render showed the texture well and a later render on the exact same scene showed the texture gone mad. No idea if I missed something or it’s a known issue or will it be fixed as I couldn’t find any other reference to it in the Blender community.
There is also a modifier that uses projections from cameras to adjust tiled mapping but it also gave me buggy results.

Plain generated mapping seems to work without fail, I hope it stays like this in the following Blender releases.

Categories : Beginner, Materials
  • Carrozza

    Interesting post as always.
    Nice model, by the way.
    Cheers! ^__^

  • Oana

    Thanks! A bit of encouragement to get me started on the UV mapping post 🙂 – that will be tough as it took me ages to “get it”!

  • Jon

    Just a quick question, is there a way to take the generated texture alignments and apply as UV coordinates, for example exporting a model building to a game engine?

  • This isn’t all that related to this tuiartol (which looks to be more helpful info as well), but it is to do with this character, as well as the B C Baker one.I notice a mild case of Popeye arms happening , where the forearms are somewhat bigger than the upper arms. Is this strictly an style preference, or is there a practical side. I ask because wrists and forearms continue to be the most problematic areas for me. Even using the segmented bones, no matter what I do I can’t rotate the hands into all the positions real hands can without ugly, rumpled twisting. I haven’t gone as far as trying a shape key to counter it yet, but I have yet to create an arm that doesn’t have these problems.So I was just wondering if the slighly thicker ones are at all related to issues like that, or if it’s just a preferred look.

  • RudyD

    Auto texture mapping is broken in blender when applying an image as texture to a curve, it’s broken in 2.74, and it has been broken since blender 2.69. I do a lot of cutouts, and applying images to the cutouts, as the curves can be made to exactly match the contours(inner, and outside of my images that are applied to imported SVG’s as a image texture. I will take the Images into Gimp, add an alpha channel, and cut out any of the background using the various select tools in Gimp, and after getting my cutout texture with the background completely cut out, and completely transparent I’ll select the alpha cutout region in Gimp with the select by value tool, invert the select and transform the selection to a path. I will then export the path to an SVG that exactly matches my image texture, and import it into blender, and apply the image that I used to generate the path/SVG file directly to the curve, the image was saved as PNG, and brought into Blender. This is great for making shadow box style compositions/scenes as photos of people/etc. can be made into cutout figures and place around a 3d composition. This had been working fine in blender 2.68a, but starting with blender 2.69 applying images to curves did not keep proper registration/texture alignment with a image texture applied to a curve, and the auto texture alignment settings panel is very buggy in blender 2.74 when I press the auto texture/Match Texture Space Button, it does not update the curve object’s texture space properly! And I have found that if I change one of the values in the X Y Z location or X Y Z size data entry boxes, and the press the Match Texture Space Button that the image as texture will align properly. there has definitely been a bug in the texture space code handling in blender 3d since 2.69, all the way to 2.74 the current stable release. The proper object/s are not being called at the opening of a image and applying it as a texture to a curve object(imported SVG) in blender, and the texture mapping code is not doing the proper setting of initial texture space for the object(Curve, and sometimes meshes). Also, the Match Texture Space Button is not working when pressed, and performing a texture space recalculation on the Curve object, unless one of the values in the X Y Z location or X Y Z size data entry boxes is manipulated, some calling of blender code objects to handle the button press event is not being propagated down the python code object call stack, on initial load of the image as a texture on a material, or even when the Match Texture Space Button in the object’s in the Python, class DATA_PT_curve_texture_space(CurveButtonsPanel, Panel): under the bpy.ops.curve.match_texture_space method call. This function/others is/are not being called at initial texture file load, or the Match Texture Space Button press, on curve objects, without fiddling with the data in the X Y Z location or X Y Z size data/value entry boxes.

    Applying an image as textures onto curve objects, is not even properly documented in any blender documentation, while there are tons of online documentation about UV mapping of textures, or images as textures onto meshes(simple planes). Applying image textures onto SVGs(2d planes/cutouts), or other curve type objects is a great undocumented feature, and is great for making dioramas, and cutouts of people and objects, and it works fine in blender 2.68a, and can be made to work in later versions of blender with some fiddling around with the settings(X Y Z) near the Match Texture Space Button, it’s a bug that has kept me from updating beyond blender 2.68a. I’ll keep blender 2.68a installed on my system, and use the later versions as standalone/uninstalled unzipped into a directory so I can run different versions of blender, Please note that the image texture applied to curve objects needs more documentation in the blender manuals, and Blender overall is a great open source project, but they need to fund some documenting of the features that have been overlooked, if anyone knows any good books that cover all the bells and whistles please let me know.