Skip to main content
Godot Fundamentals – Complete Beginner to Advanced Guide
CHAPTER 12 Beginner

Working with 3D in Godot

Updated: May 16, 2026
25 min read

# CHAPTER 12

Working with 3D in Godot

1. Introduction

While Godot built its reputation as a powerhouse for 2D indie games, the release of Godot 4 introduced a completely overhauled, high-end 3D rendering pipeline based on Vulkan. From low-poly PS1-style horror games to stunning, realistic architectural visualizations, Godot is fully equipped for 3D development. The best part? If you know how to build a 2D game in Godot, you already know how to build a 3D game. The Node philosophy is exactly the same; there is simply an extra "Z" axis. In this chapter, we will master Working with 3D. We will explore 3D meshes, configure lighting, and learn how to navigate the 3D viewport.

2. Learning Objectives

By the end of this chapter, you will be able to:
  • Understand the parallel between 2D and 3D nodes (e.g., Node2D vs Node3D).
  • Navigate the 3D workspace using mouse and WASD flight controls.
  • Import 3D models (.glb / .gltf) and use the MeshInstance3D node.
  • Setup a WorldEnvironment for Sky and Global Illumination.
  • Use DirectionalLight3D and OmniLight3D to illuminate scenes.

3. The 3D Node Equivalents

Everything you learned in 2D translates directly to 3D. They are just colored red instead of blue.
  • Node2D becomes Node3D.
  • Sprite2D becomes MeshInstance3D.
  • CharacterBody2D becomes CharacterBody3D.
  • CollisionShape2D becomes CollisionShape3D.
  • Camera2D becomes Camera3D.
The logic, the signals, and the GDScript functions (move_and_slide()) are functionally identical. You simply use Vector3(x, y, z) instead of Vector2(x, y).

4. Navigating the 3D Viewport

Switch to the 3D workspace at the top of the editor.
  • Orbit: Hold the Middle Mouse Button and drag to orbit around the center.
  • Pan: Hold Shift + Middle Mouse Button to pan the camera left/right/up/down.
  • Fly Mode: Hold the Right Mouse Button and use the W, A, S, D keys to fly through your world like a first-person shooter. Use Q to fly down and E to fly up.

5. MeshInstance3D (The 3D Visuals)

A 3D model (like a car or a tree) is called a Mesh.
  • When you add a MeshInstance3D node to your scene, it is invisible.
  • You must go to the Inspector, click Mesh, and choose a primitive shape (like a BoxMesh or SphereMesh), OR drag a custom 3D model you made in Blender into that slot.
  • Materials: A mesh is just a grey clay shape. To give it color or texture (like wood or metal), you must assign a StandardMaterial3D to its Material slot.

6. Lighting and Environment

A 3D world is pitch black until you add lights.
  • WorldEnvironment: This node controls the Sky, the ambient background light, and post-processing effects like Fog and Bloom (Glow).
  • DirectionalLight3D: Acts as the Sun. Its position doesn't matter; only its rotation matters. It casts parallel shadows across the entire world.
  • OmniLight3D: Acts as a lightbulb. It casts light in a 360-degree sphere.
  • SpotLight3D: Acts as a flashlight, casting a cone of light.

7. Visual Learning: 3D Scene Architecture

txt
123456789101112
[ Node3D: Level_1 ]
   |
   +-- [ WorldEnvironment ] <-- (Generates the blue sky and ambient light)
   |
   +-- [ DirectionalLight3D ] <-- (The Sun casting shadows)
   |
   +-- [ StaticBody3D: Floor ]
   |      |-- MeshInstance3D (A flat BoxMesh for the ground)
   |      |-- CollisionShape3D (A BoxShape to make it solid)
   |
   +-- [ CharacterBody3D: Player ]
          |-- Camera3D <-- (What the player actually sees)

8. Best Practices

  • Use .GLTF / .GLB Formats: When exporting 3D models from Blender to Godot, always use the .gltf or .glb format. Unlike the older .fbx or .obj formats, .glb files are fully open-source and perfectly retain materials, textures, and skeletal animations when imported into Godot.

9. Common Mistakes

  • Forgetting the Camera3D: In 2D, if you don't have a camera, Godot just shows the center of the screen. In 3D, if you do not add a Camera3D to your scene, when you press Play, the screen will be completely grey and empty because the engine doesn't know what angle to look from.

10. Mini Project: Build a 3D Physics Room

Objective: Prove that 3D is just as easy as 2D.
  1. 1. Open Godot, switch to the 3D workspace. Create a Node3D root named World.
  1. 2. To easily see, click the three vertical dots next to the Viewport "Preview" button and select Add Sun to Scene and Add Environment to Scene.
  1. 3. Create the Floor: Add a StaticBody3D. Add a MeshInstance3D child (set Mesh to BoxMesh, scale it wide). Add a CollisionShape3D child (set Shape to BoxShape, scale to match).
  1. 4. Create a Falling Box: Add a RigidBody3D high in the air. Add a MeshInstance3D (BoxMesh) and CollisionShape3D (BoxShape) as its children.
  1. 5. Add a Camera3D to the World. Pull it back and angle it downward so it can see both the falling box and the floor.
  1. 6. Hit Play. The 3D box drops, hits the floor, and tumbles!

11. Practice Exercises

  1. 1. What is the keyboard/mouse combination to enter "Fly Mode" in the 3D viewport?
  1. 2. What is the 3D equivalent of the Sprite2D node used for displaying visual models?

12. MCQs with Answers

Question 1

You want to add the Sun to your 3D level to cast shadows across the entire landscape. Which node should you use?

Question 2

When programming a 3D player character, which data type must you use to handle position and velocity, replacing the 2D Vector2?

13. Interview Questions

  • Q: Explain the correlation between Godot's 2D engine and 3D engine. If a developer knows how to build a 2D platformer in Godot, what specific node translations must they make to build a 3D platformer?
  • Q: What is the difference between an OmniLight3D and a DirectionalLight3D in terms of how they calculate lighting and shadows?
  • Q: Walk me through the recommended asset pipeline for getting an animated 3D character from Blender into Godot. What file format should be used?

14. FAQs

Q: Can Godot handle AAA 3D graphics? A: Godot 4 introduced SDFGI (Signed Distance Field Global Illumination) for real-time bouncing light, Volumetric Fog, and robust Vulkan rendering. While it doesn't match the billion-polygon capability of Unreal's Nanite out-of-the-box, it is extremely capable of producing stunning, high-fidelity 3D graphics.

15. Summary

In Chapter 12, we added a new dimension to our skill set. We discovered that the intimidating leap from 2D to 3D is actually quite simple in Godot, because the core Node philosophy (CharacterBody, CollisionShape, RayCast) remains identical. We learned how to navigate the 3D viewport, import .glb meshes via MeshInstance3D, and illuminate our worlds using DirectionalLight3D and the WorldEnvironment. The 3D world is now our playground.

16. Next Chapter Recommendation

Our game plays great, but when the player quits, they lose all their progress. It is time to make data persistent. Proceed to Chapter 13: Saving and Loading Game Data.

Finish this Chapter

Save your progress on your learning path and prepare for coding interview challenges.

Discussion

Join the discussion

Log in or create a free account to participate.

Sort: ·