Layered shading
Materials in Axis are composed of set of layers, each layer blending with the previous ones. It's similar to layers in a raster graphics editor. Every layer is defined simply by two parameters - a shading operation and a blending operation. The shading operaion is essentially what the layer does, while the blending operation is how the result of the shading operation should blend with the previous layers.
This way, the creator can build a material by combining simple operations, rather than selecting from a limited number of predefined materials, or writing code in some shading language, ending up with heaps of slightly different shaders.
This model is called Layered Shading and was created in order to provide an intuitive and functional way for shading, such as to fit with Axis' minimalistic concept.
Its main advantages are:
- There is a practically unlimited number of materials that can be built
- A material is built in a matter of seconds
- Materials are independent from the graphics device in a sense that any material can be used on any device. This means that one very same scene is renderable on any device - from the highest end graphics card, down to an old cell phone
- A graphics device needs to implement a small, finite number of operations, in order to support all features of Axis. Additionally, if a graphics device does not support certain features, it simply does not implement them, rendering the scene the way it can
- A material may take advantage of device or hardware, which does not yet exists. Because shading operations are implemented in the graphics device, if in future the engine is fed a graphics device that supports a new hardware with new capabilities, an application created now will be able to render with these new capabilities, without even recompiling the application
An additional feature to import custom shaders is planned, but is not yet confirmed, due to the limitations which follow such concept.
The following shading operations are currently available:
- None - The result is not taken into account.
- Basic Shading - Produces simple lighting from fixed source. Used as a default operation, because gives out edges and has no properties
- Material - Provides basic Ambient/Diffuse/Emissive colors and gloss factor
- Light Source - Adds a light source. Nearest lights are automatically set to the material's light sources
- Vertex Lighting - Per-vertex lighting
- Pixel Lighting - Per-pixel lighting
- Color Map - Maps a texture along the mesh's texture coordinates
- Env Map - Maps a texture as a reflection
- Normal Map - Adds surface complexity based on a normal map
- Refraction Map - Maps a texture as being refracted
- Align Screen Quad - Aligns vertices and texture coordinates to the four corners of the screen. Useful for postprocessing
- Blur Map - Gets a blurry sample of a texture
- Tint - Tints the current color with a given amount
- Horizontal Blur - Gets a horizontally blurred sample of a texture
- Vertical Blur - Gets a vertically blurred sample of a texture
- Project Texture - Projects a texture from a camera, acting as a projector
- Project Picture - Projects a texture from a camera, acting as a projector and clips the texture
- Shadow Map Writer - Creates a shadow map, projected form a camera, acting as a light source
- Shadow Map - Applies a shadow map
- Blend Texture - Blends result with a given texture and a given factor
- Texture Transform - Transforms texture coordinates
- Skinning - Performs vertex skinning animation
The following blending operations are currently available:
- None - No operations is performed. Used on layers, which do not directly affect the visual result
- Set - Sets the of the layer result directly, ignoring previous result
- Add - Adds to the previous result
- Subtract - Subtracts from previous result
- Modulate - Multiplies with the previous result
- Lighter - Outputs the lighter component
- Darker - Outputs the darker component