Blender – Making an UV Map for many seperate tiles but spare me the hand work :D

NOTICE : I just found out you just can select all seperated objects, go into Edit Mode and then create a UV Map for all of them at once. But I will let stand this article here for documentation purposes. 😀

I have a set of tiles, for example a castle. So I wanted to use just one UV Map for all of them, but I still needed them as single objects.

Doing this by hand is tedious. So I managed to find and adapt two python scripts, who do this for you.

As you can see every object has a name, that I will later need in the game engine, for example in Unity3D, to make a Prefab out of it.

So with every object selected, I use a script I adapted to generate a vertex group for every object for all its verticies in one group, which is named exactly as the object is named.

import bpy

selection_names = [obj.name for obj in bpy.context.selected_objects]

#adds all vertices to a vertix group with the object name

for name in selection_names:
    vg = bpy.data.objects[name].vertex_groups.new(name=name)
    verts = []
    for vert in bpy.data.objects[name].data.vertices:
        verts.append(vert.index)
    vg.add(verts, 1.0, 'ADD')

After that I join all the objects with Ctrl-J as usual, resulting in only one Object but all the vertex groups are still set correctly.

Then I auto-create the UV Map for the single object.

With this script ( I have to find where I found it again and by whom ) then I automatically seperate every object using the vertex groups and the name of the vertex group.

# coding=utf8
import bpy


def main():
    origin_name = bpy.context.active_object.name
    keys = bpy.context.object.vertex_groups.keys()
    real_keys = []
    for gr in keys:
        bpy.ops.object.mode_set(mode="EDIT")
        # Set the vertex group as active
        bpy.ops.object.vertex_group_set_active(group=gr)

        # Deselect all verts and select only current VG
        bpy.ops.mesh.select_all(action='DESELECT')
        bpy.ops.object.vertex_group_select()
        # bpy.ops.mesh.select_all(action='INVERT')
        try:
            bpy.ops.mesh.separate(type="SELECTED")
            real_keys.append(gr)
        except:
            pass
    for i in range(1, len(real_keys) + 1):
        bpy.data.objects['{}.{:03d}'.format(origin_name, i)].name = '{}.{}'.format(
            origin_name, real_keys[i - 1])


if __name__ == '__main__':
    main()

After that I have all the objects seperated named correctly, using their part of the shared UVMAP. 😀

Now I use the combined one to paint it in a PBR Software like Substance Painter or Armor Paint to generate the big texture using the combined texture.

This approach saves me hours. It might not be the best thing to use big 2K textures but it saves loading time and makes changing whole tilesets textures easier.

Leaf Textures

Here are some leaf textures I made. Maybe they are usefull for some. 😀

I hold a white paper under the plants and photographed them while doing my daily walks, so they are made with a handy cam and not so good daylight. I will perfect this method and do some real quality leaf texture someday. The images are transparent pngs. (CC3 – free for whatever use, maybe credit me)

I need humans.

For my little game TANK WITH LEGS I need humans. Well, also for my generic level generator.

I did quite a lot of humans with Blender. But, I want to have something I can easily parameterize, or, in the best case, just use as a module to create low poly humans from templates.

I am sure there is a commercial solution for this, but, as always, I wanted to collect experience with open-source or free possible solutions.

Two things came to my mind : One is MakeHuman, the other was a plugin for Blender, which was made by someone who worked on MakeHuman before.

MakeHuman for Linux under LUbuntu

I tried MakeHuman for Linux under LUbuntu, the new beta version of 2.1 didnt work, so I installed 1.1 form the repository they provided.

It is really a neat tool, you can do a lot quick, many configuration parameters for every body characteristic. Also a lot of clothes, that could be used as placeholder for own texturing later on.

Example Human Model made with MakeHuman

Also there seem to be many more cloth assets for it available. But the exporting didnt work and brought a python error, I was not able to fix yet.

Well, you can use MakeHuman also as Blender Plugin if you have it installed, I didnt try that, yet. [TODO]

It is really a neat tool, you can do a lot quick, many configuration parameters for every body characteristic. Also a lot of clothes, that could be used as placeholder for own texturing later on. Also there seem to be many more cloth assets for it available. But the exporting didnt work and brought a python error, I was not able to fix yet. Well, you can use MakeHuman also as Blender Plugin if you have it installed, I didnt try that, yet. [TODO]

Blender plugin ManuelbastioniLAB from Manuel Bastioni

The second tool I was trying was the blender plugin from Manuel Bastioni, ManuelbastioniLAB, which worked like a charm, but has less easy to apply parameters and no clothing options available than MakeHuman, and was quite complicated compared to the MakeHuman.

Example for a character created with ManuelbastioniLAB

And, sadly, Bastioni is not developing it any further. So it was only available from a GitHub clone, and I did not really know those guys who forked it.

Still searching for a solution. Also, I can not recommend both softwares right now, except for testing, if they suit your needs.