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.,
Node2DvsNode3D).
- Navigate the 3D workspace using mouse and WASD flight controls.
-
Import 3D models (
.glb/.gltf) and use theMeshInstance3Dnode.
-
Setup a
WorldEnvironmentfor Sky and Global Illumination.
-
Use
DirectionalLight3DandOmniLight3Dto illuminate scenes.
3. The 3D Node Equivalents
Everything you learned in 2D translates directly to 3D. They are just colored red instead of blue.-
Node2DbecomesNode3D.
-
Sprite2DbecomesMeshInstance3D.
-
CharacterBody2DbecomesCharacterBody3D.
-
CollisionShape2DbecomesCollisionShape3D.
-
Camera2DbecomesCamera3D.
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 Buttonand drag to orbit around the center.
-
Pan: Hold
Shift + Middle Mouse Buttonto pan the camera left/right/up/down.
-
Fly Mode: Hold the
Right Mouse Buttonand use theW, A, S, Dkeys to fly through your world like a first-person shooter. UseQto fly down andEto fly up.
5. MeshInstance3D (The 3D Visuals)
A 3D model (like a car or a tree) is called a Mesh.-
When you add a
MeshInstance3Dnode 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
StandardMaterial3Dto 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
8. Best Practices
-
Use .GLTF / .GLB Formats: When exporting 3D models from Blender to Godot, always use the
.gltfor.glbformat. Unlike the older.fbxor.objformats,.glbfiles 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
Camera3Dto 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.
Open Godot, switch to the 3D workspace. Create a
Node3Droot namedWorld.
- 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.
-
3.
Create the Floor: Add a
StaticBody3D. Add aMeshInstance3Dchild (set Mesh toBoxMesh, scale it wide). Add aCollisionShape3Dchild (set Shape toBoxShape, scale to match).
-
4.
Create a Falling Box: Add a
RigidBody3Dhigh in the air. Add aMeshInstance3D(BoxMesh) andCollisionShape3D(BoxShape) as its children.
-
5.
Add a
Camera3Dto the World. Pull it back and angle it downward so it can see both the falling box and the floor.
- 6. Hit Play. The 3D box drops, hits the floor, and tumbles!
11. Practice Exercises
- 1. What is the keyboard/mouse combination to enter "Fly Mode" in the 3D viewport?
-
2.
What is the 3D equivalent of the
Sprite2Dnode 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
OmniLight3Dand aDirectionalLight3Din 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.