Search
Start typing to search...

Advanced Graphics Tasks

Author:
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 some of the most frequently used and more advanced solutions to some problems. Explaining them using example projects.

Automatic Env Map Generation

As mentioned earlier you can generate cube maps inside Aximmetry, by default, this is done once at load and sometimes we don't want that because it does not allow changes in the scene. To avoid that we can set up a little logic to generate it when necessary.
We have an example scene: Auto EnvMap Gen.xcomp we will use this to explain how to set up this feature.
Open the example project.
Once it's loaded you will be greeted by a rabbit in a colored room:

As you can see the rabbit has a metal material applied to it and it reflects the color of the walls.
On the dashboard, we have 2 color properties and a generate trigger:

If we change any of the colors or press the Generate trigger the Env Map will be generated again.

We added a new Env map generator for the bunny and fed that signal into a dedicated tunnel:

Then we changed its Index to 2:
We will talk about why this step is important later.

We have moved the generator to be inside the bunny:

This tunnel is then connected to the Bunny's shader:

Changed and Changer


These two compounds take care of deciding when to generate a new Env Map.

Changed

This is optional. It sends a bool signal if any of the inputs change.
If you want to change other parameters you need to extend this module accordingly.

Changer

It has a Changed input if that is true the Env Maps are regenerated.
If you have a Changed compound you should connect its Changed output here.
If you don't have a Changed module you have to press the Generate trigger to regenerate the Env Maps.

There are a few settings you need to set up in the Changer to operate properly.

  • Iteration Number - This number sets how many times it will take to generate the env map, by default, it is set to 3 and we recon this value should not be changed.
  • Generator Number - This number sets how many Env Maps need to be generated, this value should be the Index of the last Envmap generator in your scene. In the tutorial, it is set to 2.

Running Generator output is then connected to the Env Map generator's Running input:

As earlier mentioned we had to change the Index of the new Envmap generator that we added for the Bunny.
This is required as the Changer generates one Envmap after the other.
Adding further Envmap generator also needs:

  • Their Index to be changed
  • Generator Number property of the Changer compound to be increased. As a general rule Generator Number = Index of the last Envmap generator
  • Their video fed into a new tunnel.

Colorizing baked lights

As mentioned earlier baked lights are static and once they are baked in you can't change them. There is however a workaround to be able to change the color of certain lights and the area they light up.
We also have a tutorial project for this: Colorizing Baked Light.xcomp We will use this to explain how to do it.
After opening it you will see an emissive sphere inside a cube:

On the Dashboard, we have a Color property and if we change it both the sphere and the area lit by it will change their color:

In the tutorial project, you will find notes that will guide you through setting up this scene but we will explain it here as well.

Creating the lightmaps

For this to work we will need 2 different lightmaps for the box:

  • 1 lightmap with all light sources turned on EXCEPT the Sphere
  • 1 lightmap where only the Sphere is turned on and ALL OTHER light sources are turned off.
     - It is very important that the Sphere emits white light and its power is set to 1.

Coloring the lightmap

The lightmap where only the Sphere was turned on is fed through a filter node:
The Filter node colorizes the texture.

A Copy Color node is connected to the Filter to be able to change the color of the parts that are lit by the Sphere.

The colorized Only Sphere lightmap is then added together with the No Sphere lightmap using a Blender node.
The Blender node's Blending Mode needs to be set to Add(5).

The results then can be fed into the Lightmap input of the Box's shader. 
This method will give mathematically correct results.

Colorizing the Sphere

After we have colorized the lightmap we need to change the color of the Sphere as well.
Add a Solid Color node.
Connect the Copy Color node to the Solid Color node
Connect the Solid Color node to the Emissive Map input of the Sphere's shader:


Pass on Change Holder

As mentioned earlier these texture modifications are relatively expensive to calculate therefore we do not want to calculate them in each frame. To stop them from generating in each frame we can use a Pass on Change Holder compound.
You can set it up like this:

In our case, we only want to change the color of the emissive sphere so we will use that parameter to tell the Pass on Change Holder when to let the calculation proceed.
We will do it by connecting it to any of the Param X inputs of the Pass on Change Holder.

This setup is only an example you can use this compound after any texture calculation.

Changing texture attributes

When loading texture files you can change many attributes associated with them.
It is important to know that attributes are applied when a texture is loaded in the scene.
You can change the attributes of the loaded textures in
In the Dependency manager:

Right-click on the selected texture and click on View/Change Attribute:

Or at the Texture's Properties:

There is an important difference between the two methods:
- Changing the Attributes in the Dependency Manager will make all usage of that texture inherit the same attributes.
- Changing the Attributes at the texture will only apply the attributes to that instance of the texture.

After clicking on the View/Change Attributes or the Triangle button a new window will pop up:

Here you can adjust the following Attributes:

  • No premul - By default Aximmetry works with Premultiplied alpha by turning No Premul on you turn this feature off.
  • Color Space - Keep - Aximmetry will not convert the texture.
                         - sRGB to Linear - Aximmetry converts the sRGB image to Linear. Note: This conversion is done automatically when Aximmetry is in Linear mode.
                         - Linear to sRGB - Aximmetry converts the Linear image to sRGB. Note: This conversion is done automatically when Aximmetry is in sRGB mode.
  • Crop - You can use this property to crop out the sides of the image.
  • Resize - You can resize an image .
  • Cube - If you have a cube texture in a 2D layout you can set it here. 
  • Volume - If you have a volume texture in a 2D layout you can set it here by specifying the Columns and Rows.
  • Array - If you have an array texture in a 2D layout you can set it here by specifying the Columns and Rows.
  • Normal - Can be used to convert heightmap to normal map.
  • Irradiance env - Can convert a normal cubemap to an Irradiance cubemap.
  • Specular env - Can convert a normal cubemap to a Specular cubemap.
  • Mipmaps - Can be used to generate Mipmap to a 2D texture, use Bicubic for the best result. Adding Mipmap doubles the memory usage of the texture but makes it faster.
  • Convert - Can be used to convert an image to the listed formats.
  • Layer -  Can be used the select a layer from an imagefile.

Bake to DDS

As mentioned earlier the attributes are applied on load.
Using the Bake to DDS functions you can save these out to a new .dds file.

Article content

Loading
Close
Loading spinner icon
1/10