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