Lighting is an important part of creating a 3D game.
It sets the mood and can be used to create interesting effects.
Save the Scene as TestLight
Add a MeshInstance3D Node
Search for DirectionalLight3D
A Directional Light is like the sun, emitting light in a single direction.
When you create it, you will see a white arrow pointing in the direction that the light is coming from.
You can rotate the Directional Light node to change the direction of this arrow, and therefore the direction that the light faces in.
A directional light has an infinite range and will cover your entire scene, but...
only from the angle it is facing,
the position of the Directional Light will also not change how it affects the scene.
in the direction that the arrow is facing.
You can change the color and energy
of the light in the Inspector window.
The energy is the intensity of the light
It can be set to zero to make it appear as if there is no light.
Delete the DirectionalLight3D node.
An Omni Light emits from a single point in all directions.
Like a candle or light bulb, it acts much like a light in real life.
When you create an OmniLight3D node,
you will see a wireframe sphere on the
outside, which represents the range of the point light.
You will notice if you move the light next to the sphere,
it lights it up from the origin point.
Create a PlaneMesh to make the effects of the light more visible.
Experiment with colour, position and intensity (energy)
Delete the OmniLight3D Instance.
A SpotLight3D node emits in a cone shape and is good for things like headlights and street lamps.
Once you create a Spotlight, you will see a white cone wire frame, which shows the angle of the
light. You can click and drag on the orange circles to change the angle and range of the light.
You can also change the color
and energy (intensity) of the light in the inspector.
To cast a shadow, open the shadow