Lighting in Godot – Complete Tutorial (original) (raw)
Unleash the full potential of your game’s visuals with our in-depth guide on mastering Godot light techniques!
Lighting is an important part of games – not just allowing players to see the game world, but changing the entire feel of the game. In this tutorial, we are going to learn about Godot lights by setting up a player character lamp. Enhancing the game’s look and feel, the lamp will project light — switching a boring floating light to a more attractive and immersive detail. We particularly delve into utilizing a 3D lantern model and implementing bloom or glow effects for a realistic play scenario.
You are expected to know the basics of the Godot engine for this tutorial. If you’d like to learn more about the application of lighting, you can also explore our full course, Create a Horror Game in Godot 4 which in-depth covers how lighting can be effectively used while building a horror game.
Let’s get started with our Godot light example!
Table of contents
Project Files
While you can create your own assets in this project, we have included the 3D model for the lantern used in this Godot light tutorial for you to download below (along with some bonus assets).
FREE COURSES AT ZENVA
LEARN GAME DEVELOPMENT, PYTHON AND MORE
AVAILABLE FOR A LIMITED TIME ONLY
Player Lantern
As mentioned, in this tutorial, we will be setting up a lamp for the player’s character in the Godot game engine. The lamp will be an object held by the player’s character to emit light. The process involves creating a 3D model of the lantern, adjusting its position and size, and making it appear as if it’s emitting light through the use of glow or bloom effects.
So let’s get started with this simple way to learn how to work with the Godot light system.
Setting up the Lamp
First, we need to open up our player scene. This can be done by clicking on the player in the main scene and clicking on the icon where it says “Open in editor”.
With our Player node open, we can start editing it for our lamp. Right-click on our camera, add a child node, and create a node 3D.
Rename this node to “lantern”.
Make our omni light 3D a child of ” lantern” and set its position to zero. This will be our main Godot light.
Select ” lantern” and move it forward (so our first-person player can slightly see the lantern).
Add a 3D model as a child of ” lantern”. This model will be our lantern, and you can find it in the models folder as “Lantern.obj”.
Set the lantern model’s position to be 0, 0, 0. Adjust its scale down to around 0.15 to make it appear smaller.
Apply the “lantern glass” material to the lantern model.
This can be done by going to the inspector, selecting “surface material override”, and dragging the material onto the middle slot.
Adjusting the Lamp Position
Once the lamp is set up, we need to adjust its position relative to our player’s view. This can be done by repeatedly pressing play, observing the lamp’s position, and tweaking it until it’s in a satisfactory position. There is no right or wrong, as our Godot light will work wherever you decide to put it. Position your Godot light for the aesthetics you want.
Making the Lamp Emit Light
To make it appear as if the lamp is emitting light, we need to adjust a few settings. Select the lamp, go to its geometry settings, and set “cast shadow” to off. This will prevent the lamp from casting any shadows. This can also give your Godot light a slight performance boost if you’re on a lower end machine.
Select our omni light 3D, go to the inspector, and under the light dropdown, increase the size property (we used 0.228). This will increase the minimum range of the Godot light.
To make the Godot light seem to glow, we need to enable the glow effect. In our main scene, select our world environment, find the glow dropdown in the properties, and enable it. Change the blend mode from “soft light” to “additive”. This will make the light appear brighter. Adjust the strength of the glow effect as needed. In this tutorial, a strength of 0.7 was used.
You can also adjust the brightness of the Omni light for a more moody effect. In this tutorial, the brightness/energy was set to 2.
And there you have it! With these steps, you should be able to set up a lamp for your player’s character in Godot.
Godot Light Techniques Wrap-Up
This brings us to the end of our Godot light techniques tutorial! You have now gained knowledge on creating an appealing lantern for a player’s character in Godot to make your lighting more dynamic. Furthermore, you learned how to adjust the lamp’s position and size, and how to apply a glow or bloom effect for a realistic light emission. This exercise not only contributes to your technical skillset but aids in boosting the appeal and in-game atmosphere through more intricate details.
This is the perfect solution for any kind of game, but especially horror games. If you want to design your own horror game, the free video tutorial below can help you get started with this endeavor.
For those with broader interests, Zenva also offers a comprehensive list of diverse courses covering different aspects of game development – from FPS and RPG game constructions to cross-platform programming.
Hope this tutorial served you well, and blossomed your intrigue in the gaming development ecosystem. Eagerly waiting to see where these new skills take your future projects!
Curious to dive deeper? Enroll in our comprehensive Create a Horror Game in Godot 4 course now.
Did you come across any errors in this tutorial? Please let us know by completing this form and we’ll look into it!