First (not so) fancy tree in a Godot scene

And how to import a Blender model into Godot

ยท

4 min read

After making a really fancy donut in Blender, it's now time to put those newly learned beginner modeling skills to use and create a first tree object. I was aiming for something very simple and minimalistic, as my first priority was to learn and test how I could import a 3D model made with Blender into a Godot scene.

And I would say I nailed it. What do you think? ๐Ÿ˜œ

It was done really quickly. Just a cylinder with a sphere on top and some non-reflective one-colour material for the stem and crown of the tree.

I set up a simple 3D scene in Godot for that purpose with the following elements:

  • A ground, which I gave a collision and a dark green coloured mesh,

  • some lighting

  • a camera

  • and finally the first fancy tree (as a static body 3D object, instanced as a scene).

As you can see, I have it incorporated as a scene in my project. There are several ways to import Blender models into Godot. You can read about that here on the official docs: https://docs.godotengine.org/en/stable/tutorials/assets_pipeline/importing_3d_scenes/available_formats.html

Import Blender models into Godot

The method I chose was to have Godot automatically detect Blender files in its project folder structure and import them. This comes with the great advantage of being able to have Blender open and make changes to the object, which get updated in Godot as soon as the changes are saved in Blender. You can check out my corresponding GitHub project if you are interested in more details of this setup:

A Fancy Tree

To achieve this, it is important to not only have Blender installed, which is rather obvious, but also to set the path to the installation directory of Blender (not the executable file!) in the editor settings of Godot. You can find the setting via the menu bar:

Editor > Editor Settings > File System (left side in the scrollable list) > Import > Blender 3 Path

It should look like this:

As I installed Blender via Steam, the installation path looks as follows on my system:

C:/Program Files (x86)/Steam/steamapps/common/Blender

Don't be confused that "Blender 3" is written in the setting. It should be totally fine to use a newer version of Blender. I had no issues using Blender 4.1 with it so far. However, you should not use versions older than Blender 3.

As soon as that is set, .blend files are automatically imported by Godot as long as they are within your Godot project's path. You'll see a file like name_of_the_model.blend in your path, and when you double-click on it, you get several additional import options. That looks like this:

I didn't need those extra options for now, so I just ignored them.

The best way to use such a model is probably to have it directly in its own scene. Therefore, I created a new scene file where I just dragged in the .blend file. It then gets converted to a Node3D object and can be found in the scene tree. Having it in a scene comes with further advantages, like setting collision shapes as I did:

In my case, I added a spherical collision shape for the tree crown and a cylindrical one for its stem. I tried to match the shapes to the shape of the tree. Collision will become important later on when I implement player interaction (or game object interaction in general).

That scene can then be instantiated and used within other scenes. I did this in my main scene. After saving the tree object scene, I just added it to my main node by dragging the scene into the scene tree. Afterwards, I adjusted the position, repositioned the camera and light (as I wouldn't have been able to see anything otherwise when running the scene), and that was it. I was done.

It was really a happy moment for me as I hadn't done something like that before. I find it awesome how easy such a workflow can become once you know what you have to do. ๐Ÿ˜Š

As a next step, I intend to create a very simple and minimalistic player model and code some first-person-view movement using C++, so that players will be able to walk around the tree. And probably after that, I should do something about the sky. It doesn't look very appealing in its current form. ๐Ÿค”

Until next time!

โ€“ Zacryon

ย