Making a Game - Creating Weapon System Visuals - EP 15

by

Video Tutorial

Aims of this Tutorial

  • Create a gun model in Blender with 2 materials and export to Godot.
  • Modify the materials in Godot to add some detail.
  • Make a weapons panel with a battery made in GIMP.

Creating a Gun in Blender

First off, we need to start with a cylinder as our starting point. Just like we did with the ship, we can then turn on Catmuli-Clark subdivision surface modifier. Now we have a bunch of artifacts that we need to remove. To do this, we need to go into edit mode (TAB) and add in loop cuts (Ctrl-R) around the cylinder on both ends and inset (I) the end faces. Now we can add in some loop cuts and scale (S) them along each axis (X,Y,Z) until you are satisfied with the result. To modify the loop already made, you can either select them while holding Alt, or select wireframe mode in the top right and use the box select tool (B).

Now head over the shading tab and create two materials for the gun in the right hand side panel. Apply the second material to the bottom half of the gun. To do this you can select the bottom half in edit mode. While still in edit mode, you can select the second material and click apply. Now we can export as gltf 2.0 and move it into the project directory.

Modifying the materials in Godot

Now we have it imported, we need to create materials in Godot. We did not do this in Blender because the node system is too complicated for Godot. Open the model and select one of the two materials and create a new Godot material for it. Now you can modify that material. To get extra detail, you can use a texture in each tab, and pick a noise texture. This will procedurally generate a texture. Now do the same for the other material.

Creating the Weapons Panel

Firstly, we can create a panel node under the player. We can then add in a few texture rects (we will create the textures for this in a bit). We also need a toggle switch to turn it on and off. Now to create the battery icon, install GIMP with the export-layers plugin (on Arch, you can install the following AUR packages: gimp-plugin-export-layers, python2-gimp). Now open up GIMP and design your battery. I went with a blue square, with a blue nibble on top. Then I created a black background on another layer and a lightning bolt from nerd fonts in yellow on yet another layer. Now, we can use the export layers plugin to export each layer separately into the project folder. We can now set the textures for the texture rects with the exports. By doing this in layers, we maintain control over each layer in Godot. In the next episode, we can use this to show how much energy the weapon has to use firing.