Please note that this is a BETA version of the document. All information presented is correct but we are working on improving the details. |
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 IBL
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.
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 your scene's Renderer compound and exposing the Lights output like so:
If you are using the default Renderer compound we recommend unlinking it.
Then you can wire any dynamic light to it and that light will have a Volumetric effect.
Pay attention to connect the Affected Volume pin to it:
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 IBL or their combination.
Lightmaps can be used with shaders that have LIGHT in their name.
Pay attention not to use a complete map as described here.
IBL
IBL is an abbreviation for Image-Based Light which means 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.
In Aximmetry we can differentiate between two kinds of 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
In Aximmetry we are using cubemaps. This means that the texture is either in a cube format or in a layout that can be converted into cube format.
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.
Either method you chose you should use a shader that has IBL in its name, indicating that that shader can use environment maps to light the object.
Loading your Env Maps
If you already have an Environment Map you can load the following formats:
- DDS cube
- Set Irradiance Env / Specular Env attribute
- Vertical / Horizontal cross
- Set Irradiance Env / Specular Env attribute
- Set the Cube attribute to Vertical / Horizontal Cross
- Horizontal strip
- Set Irradiance Env / Specular Env attribute
- Set the Cube attribute to Horizontal Strip
Note: If you already have an Irradiance and/or Specular environment map you only have to set the layout attribute.
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.
Generating Env Map in Aximmetry
If you wish to generate an environment map using Aximmetry you will need an Envmap_generator.xcomp compound and connect it like so:
Currently, Envmap_generator.xcomp only generates a Specular environment map and it is advised to combine it with a lightmap to get the best possible result.
- You can also extend this compound to also generate Irradiance Env map by setting up the following structure inside:
Then you can use the second output as an Irradiance Env Map input at the desired shader.
Select the Envmap_generator and move it(using the transformation gizmo ) to the position from where you want to generate the Environment Map.
- ideally, this should be moved inside the object that you are generating the Environment Map for.
In this example, we have moved it inside the cube.
Connect its output to the shader Specular Env Map input. You can connect it directly or using a Transmit module's tunnel. You can read more on how tunnels and Transmit modules work here.
Envmap_Generator runs once when an Aximmetry project has started, you can read about how you can generate it again here.
Adding new Envmap generators
To add new Envmap generators all you have to do is duplicate the Envmap_generator.
Then you can move it to a different position, to the position of the object you want to generate the Envmap for.
Then connect it to the shader of the object.
Here you can see two cubes each with their dedicated Envmap generators placed inside.
Special Env Map tunnels
This is a special tunnel and every IBL shader uses this tunnel as their Specular Env Map input by default. If you wish to add a dedicated Env Map for that object you can always overwrite it by connecting/adding another texture to that input.
We also have a special tunnel for Irradiance Environment Map, it is called Global Irradiance Env Map:
Do not forget to take the steps mentioned earlier on how to add an Irradiance Env Map generation to the Envmap_generator
Note: You don't have to connect these tunnels to any of the shaders, it is done automatically by the system.
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 his:
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.
In the next tutorial, we will be talking about how to set up Shadows.