Introduction
In this documentation, we will go through the different ways you can add lights to your scene.
Visual examples in this documentation feature our Mini Studio stock scene.
Types of lighting
There are 3 different ways to light an object: Dynamic light, Static light, and Image-Based Light.
Dynamic lights
Dynamic lights are usually used for moving objects or lights so they can cast real-time shadows and lights. They are relatively expensive performance-wise so it is advised to keep their number low. They don't give as nice results as static lights.
You can have the following dynamic lights in Aximmetry:
You can change their color, intensity, direction, and the parameters of the shadows they cast.
Keep in mind that Ambient and Point lights don't cast shadows.
You should set up your connections like so:
NOTE: We used a directional light in this example but you should set up every other type the same way
Notice that in addition to the Children-Parent connection, an Affecting Lights - Affected Object connection has been made.
This is required for the light to light the objects and cast shadows.
This also means that every object/scene node under the scene node that you connected the lights to with the Affecting Lights - Affected Object connection will be affected unless they have their Inherit Lights property turned off in the Pin Values window.
In this example, we have turned off the Inherit Lights property for Scene Node 3 resulting in Scene Node 3 and Scene Node 4 not being affected by the lights.
Here you can see a more complex example:
This will result in one box that is not affected by the lights, one that is affected, and one that is not affected by having its Inherit Lights property turned off:
Using the Affection connections you can set exactly which object you want to have affected by which light.
Volumetric Lights
Also known as 'God ray' in 3D graphics is a solution to show the beam of light, typically in foggy or dusty environments.
If you wish to add Volumetric light to your scene you should use the Light Volume node.
We suggest adding it to the end of your scene's Renderer compound and exposing the Lights output like so:
If you are using a default Renderer compound we recommend unlinking it.
Then you can wire any dynamic lights Affected Volume pin to it and those lights will cast volumetric lights.
You can adjust some settings in the Light Volume node:
- Max Distance - The maximum distance (in meters) from the camera after which the effect fades out.
With too large values the effect quality degrades. Therefore set it to the smallest possible value suitable for your scene. - Ray Steps - The number of calculation steps along each view's rays. The larger the value, the better the effect quality, but the more the impact is on the GPU.
- Absorption - Light absorption factor of the air. The higher the value, the greater the attenuation of the effect with the distance.
- Albedo - Sets the overall intensity of the effect
- Blur Sharpness - The higher, the more the blur preserves edges.
Static Lights
Using Static Lights/Lightmaps is a good option to get realistic lights, shadows, and color bleeding. Static lights are also very performance-efficient. They are, however, as the name states: static so you can not move them.
Keep in mind that Lightmaps only contain diffuse light. If you wish to have specular highlights you need to use dynamic light or Image-Based Light or their combination.
Lightmaps can be used with shaders that have LIGHT in their name.
You can learn more about lightmaps here.
Image-Based Light (IBL)
When using IBL the shader uses Environment maps to light the object and create reflection on it.
IBL treats the surrounding environment as one light source thus giving a more realistic feel to the object.
Environment maps add a lot of realism to the scene therefore it is advised to use them.
Generally speaking an Environment map is a texture that stores the surroundings of the point it has been captured from.
An Environment map can be converted into a special Environment Map to serve a specific function. These conversions can be done either in Aximmetry or in some third-party software.
In Aximmetry we can differentiate between three kinds of special Environment Maps:
- Irradiance Environment Map - This map contains the average color or lighting of the environment giving us diffuse reflections.
- Specular Environment Map - This map gives Specular highlights to the objects.
- Sheen Environment Map - This map could be used with Sheen materials for more realistic reflections.
Most of our PBR IBL shaders let you set the same Environment Map (Env map), both as Irradiance Env Map and/or Specular Env Map and/or Sheen Env Map
- Irradiance, Specular and Sheen Env Maps can be generated from any captured or generated environment map using Attributes.
NOTE: To get the most realistic diffuse reflections we suggest using lightmaps as explained here.
In Aximmetry we use cubemaps as environment maps. This means that the texture is either in a cube format or in a layout that can be converted into a cube format.
In some cases, you might have a texture that is in a different layout, spherical mostly.
You can learn how to convert them to Cubemaps here. - coming soon
Supported Layouts and their order of views:
- Vertical Cross - Top, Left. Front, Right, Back, Bottom
- Horizontal Cross - Top, Left, Front, Right, Back, Bottom
- Horizontal Strip - Right, Left, Top, Bottom, Front, Back
You have two options to use environment maps:
Load one that you already have or generate one in Aximmetry. You can learn more about generating an Env Map here.
Either method you choose you should use a shader that has _IBL_ in its name, indicating that the shader can use environment maps to light the object.
Loading your Env Maps
When loading a pre-made environment map in Aximmetry you need to set some attributes depending on the file format that you are using.
You can learn more about setting the attributes here.
Aximmetry supports the following environment map formats and requires the listed attribute settings:
- DDS cube
- Set Irradiance Env / Specular Env / Sheen Env attribute
- Vertical / Horizontal cross
- Set Irradiance Env / Specular Env / Sheen Env attribute
- Set the Cube attribute to Vertical / Horizontal Cross
- Horizontal strip
- Set Irradiance Env / Specular Env / Sheen Env attribute
- Set the Cube attribute to Horizontal Strip
NOTE: If you have a Irradiance, Specular and/or Sheen Env Map that has already been converted before importing those can only be used as the corresponding input otherwise you will get incorrect results.
In this case, you should only set the layout attributes.
You should connect the Env Maps to their corresponding input pin.
This is just an example you can use other methods to connect the textures but make sure to set the attributes correctly.
Special tunnels for Environment Maps
You may already know that Aximmetry has so-called tunnels, these tunnels can transmit data without a direct connection.
You can use special tunnels to transmit environment maps directly to every IBL shader that doesn't have one connected/added to it.
These tunnels have to be named:
- Global Specular Env Map - for specular environment map
- Global Irradiance Env Map - for irradiance environment map
- Global Sheen Env Map - for sheen environment map
Best practice
The best practice is to combine static lights (lightmaps) with Specular environment maps. This way you will get the most realistic results.
You should generate the lightmaps in your modeling software and generate the Specular Environment Maps in Aximmetry.
Your completely set-up shaders should look something like this:
NOTE: We have also added a Planar Reflection to the plane, which we will discuss here.
This is only an example, you can always connect the textures in other possible ways. Please note that tunnels can only be connected this way.