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.

More about Actionable Objects. ( InterAction Project Series )

Let’s have a look how this little system I am doing enables the player to open and close this power block door, as a simple example.

The orange door you see in the scene view in the picture above has a component called ActionableObject. If the layer „ActionableObjects“ exists, a GameObject with this component on it will be set to this layer. This is needed because the raytracing of the EyeModule only hits on objects in this layer. (If the layer does not exist, errors will be thrown, but there is a convient editor menu where you can create all needed layers without having to add them manually.)

„More about Actionable Objects. ( InterAction Project Series )“ weiterlesen

The ActionableObjects and the User Input

When the player has focused an object that, or, on that an action can be performed, a menu with the action options is shown. (see last entries)

Overview of the flow of user input to actionable objects

In the character controller, which handles the player input, the event functions in the scene controller for these two actions are registered to event delegates in the character controller.

„The ActionableObjects and the User Input“ weiterlesen

Lara, wheres the croft

So I played Rise of the Tomb Raider from 2015.

I was not a big fan of the Croft franchise, ever. But this game taught me quite a lot about puzzle making and the development of open world games since 2015, as did the Assassins Creed franchise. Funny, that they mostly all use exact the same mechanism, but the puzzle thing is where Croft scores.

Also this combination of micro-movie sequences and gameplay was interesting.

I now tested the trial version of Shadow of the Tomb Raider from 2018, most settings to Ultra. And wow, the graphics f*cked my brain.

Also and that is interesting, the facial expressions of the modern Lara are not as good as in the 2015 version, by far.

Level Generator

Once you write a structure down, it is most of the time not as complicated anymore. Actually. I am dissapointed how NOT complicated my structure of my Level Generator actaully is. 🙁 🙂

Of course there is a lot…well some more going on. The street map generator also calculates the spaces for the buildings available. But that is for another entry.

Fast And Furious Image File Tagger (FAFIFT)

I needed a quick way to add tags to image files. A really quick way.

After searching for a program that fits my need, I was not able to find anything which would allow me to do this in a fast, simple and OS independant way.

In a flash of I NEED THAT I did it myself. After not so carefull planing I decided to give windows forms with C# a try, since I got quite used to Visual Studio thanks to Unity.

The result is the „Fast And Furious Image File Tagger“ (FAFIFT). It simply adds tags to the front of the file name and seperates them with two double underscores. Then you can use any search from any OS to find the images you tagged.

Screenshot of FAFIFT

It saves the tags in a sqlite database and offers a autocompletion for tags you used before. It offers a tag editor and stores some statistics about the use of the tags.

The program still has some minor bugs, but I work with it daily and it really, really helps me to bring chaos into my pictures…eh ORDER. Also if I find something anoying or a minor bug, I update it quite fast.

I will not provide a compiled version yet, but the source is freely availabe on GitHub.

If anyone wants to make a good icon for it and donate it to the project, I would be happy ! 😀