Logo 3.5Cats_AndHalfAFish


Stone tablets (part 2).

June 25, 2020 Shade, Blender stuff
Quick tips.

Note : Godot 3.2.1, Blender 2.82.

Random tip 1 - baking textures

Baking the diffuse and normal textures for a rather long stone tablet (12x1 m) with text was a bit tricky.
To get the desired visuals for the stone texture, I had to use a 4x scaling in the UV Editor :

Blender : uv mapping for stone texture.
Blender : uv mapping for stone texture.

The text texture uv mapping looks like this :

Blender : uv mapping for text texture.
Blender : uv mapping for text texture.

So far, so good.
The problem pops up next, when you try to combine these textures into one (for the game engine).

If you bake everything -as is- into a 1024x1024 texture, the resultion (detail) will be at least 4x less then before ! The reason of course being that this new texture is clipped rather than tiled (because of the pesky text).

Blender : combined uv mapping for bake.
Blender : bad combined uv mapping for bake.

So, you could use a (1024*4)x(1024*4) texture, and waste a lot of space.
Or, you could use a (1024*4)x(300-ish) texture (Godot doesn't mind -if- you use GLES3), but I'm not sure if that would be wise (non-power of two ?).
Or, you could cut the long mesh into 4 parts (loopcuts) and add seams, and try to fit that onto a 1024x1024 texture in a way that the scaling is almost 4x. This is what I ended up using (but I already gave that away in the previous images =) ).

Blender : combined uv mapping for bake (2).
Blender : better combined uv mapping for bake.
Blender : mesh seams.
Blender : mesh loopcuts and seams.

When you bake the mesh information into the final diffuse and normal maps, don't forget to select the correct uv map in the UV Editor ! It seems that Blender doesn't pick up the UV node attached to the texture in the Shading Editor ...

Blender : mesh seams.

For instance, when you bake the final normal map with 'UVMap' selected in the UV Editor (instead of 'uv_bake'), and even with the UV_Map node set to 'uv-bake', you would get :

Blender : baking with wrong uv map selected.

And this is the result with the correct uv map selected in the UV Editor :

Blender : baked diffuse texture.
Blender : baked diffuse texture.

And this is a comparison of the mesh with the original material vs. the mesh with the baked material :

Blender : mesh with original material.
Blender : mesh with original material.
Blender : mesh with baked material.
Blender : mesh with baked material (normal strength = 1).

Strangely, the baked normal map does not seem to work as well as I expected, even though (to my inexperienced eyes) it looks ok. It seems to me that the inset effect is not really showing up ...

Blender : baked normal texture.
Blender : baked normal texture.

I'm not sure why this is the case.
So, I'll leave it like this for now. Maybe in the future I'll be able to fix it.

Random tip 2 - uv unwrapping : text.

When you do the uv mapping for the text, don't forget to change the Shading Editor texture node from 'repeat' to 'clip' ! Else you won't be able to move part of the uv map off the text :

Blender : Shading Editor setting : clip. Blender : Shading Editor : unwrap.

Random tip 3 - always apply scale.

'Apply scale' (Ctrl + 'A' in object mode) before you add a bevel to the mesh.

Blender : bevel + non-uniform scale.
Blender : bevel + non-uniform scale.
Blender : bevel + uniform scale.
Blender : bevel + uniform scale.

'Apply scale' before you uv unwrap.
Fortunately, blender will flash a warning message at the bottom of the screen if you forget.

Random tip 4 - Blender startup file.

I recently found out that you can edit and save the Blender startup file ! (And don't worry, you can also reset the startup file to the factory settings.)

So, create a new file that has all your preferred settings (eg. I changed the filter settings in the outliner for Layout, Modeling, UV Editing, and Shading). Select File > Default > save startup file. Done.

Blender : changing the filter settings for the startup file.
Blender : filter settings.

Now, next time you create a new Blender file, everything will be set up exactly the way you want it !

Random tip 5 - Blender uv maps.

When you're combining (baking) several nodes into a limited number of texture, you need a couple of different uv maps. As I mentioned in the previous blog, Godot can only handle 2 uv maps (I'm still not sure how to do that ...). In my case, I had three.
When I imported that into Godot, the mesh material was ... white (even when rearranging the uv maps in Blender or marking the uv_bake as the one to use in the render). So, I had to delete the other ones before exporting.

Of course, that means these uv maps are gone.
So, if I ever wanted to change/redo something : tough luck !

The solutions I have found so far, are :
1) Save a copy of the blend file as a backup, and finish the mesh in the new copy.
2) Instead, make a copy of the mesh in object mode and hide it as a backup. Next, with the original mesh selected > menu Object : relations > make single user > object & data & materials. You can now safely delete the unwanted uv maps. They will still be stored on the copy.
Also store the original material (the one with all the nodes) with a false user, so it won't be deleted from the file.

Note - stone texture with shiny text.

Unfortunately, I haven't managed yet to export the stone tablet with the shiny text to Godot. The material always shows up white.

I'm guessing Godot does not (yet) understand all Blender shader nodes (glass shader, glossy shader, ...). I hope that at some point I will find a way to do this ...

Someone suggested to me that I should create this kind of material inside Godot instead.
I played with the visual shaders in Godot for just a short time, but, there doesn't seem to be a one-to-one mapping between the Blender and Godot nodes. I don't want to spend too much time learning the Godot visual shaders system at this point, so I'll keep that as a project for the future.

Time to move on !

Relevant information.

  • 'Blender : Render Baking' - Blender documentation.
    General information about baking textures with Cycles.