October 31, 2018

Adventures making doors in Blender

I've spent some time improving a Tesla Simulator I originally made to learn Unity. I've always thought the old models, which were made in Blender, were lacking something - and that something was gaps between the doors (and various other gaps you can find on a car).

The problem with these gaps is that when you add them you have increased the complexity of the model because the number of vertices has increased. When you model something you want to use as few vertices as possible. The reason is that if you realize that the model is incorrect, then for each vertex it takes some time to move it to the correct new position while making sure the triangles have the correct angle.

But what if there's a better way? A better way is to use modifiers, as explained in this YouTube video:

The basic idea is that where you want a gap, you mark the edge as sharp and add the edge's vertices to a vertex group. Then you add three modifiers: edge split, solidify, and bevel (make sure the bevel is using the vertex group you made), and you will see that you can make door gaps without adding new vertices. Well, your model will consist of more vertices but you don't need to move all these vertices when changing something.

But a problem not covered in the YouTube video is that when your model needs edges that are not gaps but they are sharp so you should mark them as sharp in Blender. For example, the car's rear spoiler has these edges. What you will now discover is that some new edges will appear and they will go though your model's nice triangles.

The problem is that when an edge is marked as sharp, Blender's solidify modifier is ignoring surrounding edges. To solve this problem you need another vertex group (or maybe the same vertex group you already have depending on the model) which you add to the solidify modifier, so the solidify modifier is not "solidifying" all edges, but just the edges that should be gaps. And the result is:

October 3, 2018

How you can bake textures faster in Blender's Cycles render

I needed to make a realistic tree log texture in Blender and found this tutorial: Blender Tutorial: Photorealistic Material. It turned out I needed to use Blender's Cycles render for the first time in my life. This render is node based and it makes it more complicated to export the material to a game engine like Unity. To export the material, you have to bake the diffuse texture, which is easily done if you follow for example this tutorial: How to make a bake texture in cycles. The result is this:

The problem was that baking the texture was really slow. When I googled the problem, most answers suggested that to make it faster you should make the texture you want to bake to smaller, such as 512 and not the 2048 which is what I wanted. But the one with the answer was no-one else than our dear friend Blender Guru and his video: 18 Ways to Speed Up Blender Cycles Rendering. The one "way" that improved baking was "#3 Use GPU." Apparently, most likely because not everyone has a GPU compatible with Blender, Blender is not using the GPU by default when generating images but the CPU which is slower. To tell Blender to use the GPU, you click File → User Preferences → System. And then at bottom left, you should select CUDA:

But that's not it! You also have to set the render to GPU Compute (CPU is default) in the panel to the right:

The results:
  • GPU: 2 minutes 33 seconds
  • CPU: 9 minutes 42 seconds