Material Manager

From C4 Engine Wiki
Jump to: navigation, search

Materials are organized by the Material Manager component of the World Editor tool module. To create a new material, first open the Material Manager by double-clicking on the material box on the Material page. (If the Material page is not visible, select it from the Page menu.) The Material Manager dialog appears as follows.


Material.png


Clicking on the New button will create a new material with no attributes, and clicking on the Duplicate button will create a new material with the same attributes as the currently selected material.

The Delete button can be clicked for any material that is no longer used in the scene.

The preview menu can be used to select a type of geometry on which to display the material. The material name box is used only for identifying materials in the Material Manager.

Materials may be imported and exported using the Import and Export buttons.


Shader Graphs

A material can be converted to a generic shader graph by clicking the Edit Shader button. This opens the Shader Editor window for the material. Once a shader graph has been saved for a material, the Diffuse, Specular, and Ambient tabs are no longer available in the Material Manager for that material because there's no way to map back to the standard attributes from a generic shader graph.


Diffuse

Material diffuse.png
The attributes shown under the Diffuse tab pertain to the diffuse component of the lighting passes.


Setting

Description

Diffuse color

The color of diffuse light reflected by a surface. This is multiplied by the color read from the Texture map.

Texture map (primary)

The base texture that controls the diffuse reflection color. The alpha channel of this texture may contain extra information that affects different aspects of the material. If the alpha channel contains a gloss map, then it modulates the specular reflection and the environment map. If the alpha channel contains an ambient occlusion factor, then it modulates the amount of ambient light reflected.

Texture map (secondary)

An optional secondary texture map. This texture is combined with the primary texture map using the blending function specified by the “Texture blend mode” setting.

Texture blend mode

If two diffuse textures are being used in the material, then the “Texture blend mode” menu determines how they are combined.

Normal map (primary)

The normal map that controls the bumpiness of a surface. The alpha channel of this texture may contain extra information that affects different aspects of the material. If the alpha channel contains a gloss map, then it modulates the specular reflection and the environment map. If the alpha channel contains parallax data, then the parallax mapping calculation is applied in all rendering passes.

Normal map (secondary)

An optional secondary normal map. This texture is combined with the primary normal map in such a way that the bumps add up.

Enable horizon mapping

If the “Enable horizon mapping” box is checked, then a material using a single normal map is rendered with horizon mapping when horizon mapping is enabled in the graphics settings. (The normal map must have been imported with horizon map generation enabled.) The “Exclude infinite lights” and “Exclude point lights” boxes control whether horizon mapping is disabled in this material for each class of light source.

Exclude infinite lights

If the “Exclude infinite lights” box is checked, then horizon mapping is not applied when the material is rendered for an infinite light source.

Exclude point lights

If the “Exclude point lights” box is checked, then horizon mapping is not applied when the material is rendered for a point light source.


Specular

Material specular.png
The attributes shown under the Specular tab pertain to the specular component of the lighting passes.


Setting

Description

Specular color

The color of the specular reflection. This is multiplied by the color read from the Gloss map.

Specular exponent

Controls the sharpness of the specular reflection. Higher values are sharper.

Gloss map

The texture that controls the specular reflection color. This modulates the specular reflection, the environment map, and/or the ambient reflection term. If this texture is present, then any gloss map existing in the alpha channel of another texture is ignored.

Microfacet color

The normal-incidence color of a microfacet reflection.


Ambient

Material ambient.png
The attributes under the Ambient tab pertain to the ambient lighting pass and include settings for emission, reflection, and refraction.


Setting

Description

Emission color

The color of light that the surface appears to emit by itself. The emission color is added to the ambient light that the surface reflects if this box is checked. This is multiplied by the color read from the Emission map.

Emission map

The texture that controls the emission color. This is added to the ambient light reflected by a surface.

Environment color

The color by which the environment map is multiplied. An environment map is applied in the ambient rendering pass if this box is checked. If a reflection color is specified under the Buffers tab, then the environment color is ignored.

Environment override map

The environment map texture. This must be a cube map, and it overrides any environment map specified in a zone. The environment map only has any affect when the environment color is also specified under the Colors tab.

Reflection color

Specifies the color of the contribution from the reflection buffer. This is modulated by the color read from the Gloss map.

Refraction color

Specifies the color of the contribution from the refraction buffer. The refraction term is linearly interpolated with the diffuse reflection term using the color read from the Opacity map.

Opacity map

The texture that controls the surface opacity when there's a refraction term. This is used to linearly interpolate between the diffuse reflection term and the refraction term in the ambient pass. If this texture is present, then any opacity map existing in the alpha channel of another texture is ignored.


Flags

Material flags.png
The settings shown under the Flags tab control miscellaneous rendering options that are either on or off.


Setting

Description

Render two-sided

If this box is checked, then the geometry to which this material is applied is rendered two-sided so that faces can be seen from front or back.

Render with alpha test

If this box is checked, then the alpha channel of the diffuse texture is used to cut holes in the geometry to which this material is applied. Pixels for which the alpha value is less than 0.5 are not rendered. (Each pixel is either fully opaque or not rendered at all—alpha testing does not provide partial transparency.)

Usage alpha multisample coverage

If this box is checked, then the value in the alpha channel of the diffuse texture determines the multisample coverage mask in the hardware. Using this can help soften the edges of alpha-tested materials when antialiasing is enabled.

Enable per-sample shading

If this box is checked, then the shader is executed per sample instead of per fragment on hardware that supports this. Note that enabling this option can have a significant performance impact.

Apply emission glow

If this box is checked, then the glow post-processing effect is applied to emission colors.

Apply specular bloom

If this box is checked, then the bloom post-processing effect is applied to bright specularities.

Render vertex occlusion

If this box is checked, then the ambient light incident on the material is multiplied by the per-vertex ambient occlusion value, if available.

Render screen-space occlusion

If this box is checked, then the ambient light incident on the material is multiplied by the screen-space ambient occlusion (SSAO) value, if SSAO is enabled in the global graphics settings.

Diffuse color mutable

Indicates that the diffuse color could be changed dynamically. This box must be checked if the diffuse color will be modified from a script using a Set Material Color method.

Specular color mutable

Indicates that the specular color could be changed dynamically. This box must be checked if the specular color will be modified from a script using a Set Material Color method.

Microfacet color mutable

Indicates that the microfacet color could be changed dynamically. This box must be checked if the microfacet color will be modified from a script using a Set Material Color method.

Emission color mutable

Indicates that the emission color could be changed dynamically. This box must be checked if the emission color will be modified from a script using a Set Material Color method.

Environment color mutable

Indicates that the environment color could be changed dynamically. This box must be checked if the environment color will be modified from a script using a Set Material Color method.

Reflection color mutable

Indicates that the reflection color could be changed dynamically. This box must be checked if the reflection color will be modified from a script using a Set Material Color method.

Refraction color mutable

Indicates that the refraction color could be changed dynamically. This box must be checked if the refraction color will be modified from a script using a Set Material Color method.

Substance type

Selects a substance type for the material so that the game code can determine what kind of substance (such as rock, wood, or grass) was involved in a collision. Substances must be registered in the game code in order to appear in this list. See the Substance class.


Texcoords

Material texcoords.png
The attributes shown under the Texcoords tab control how textures are mapped and animated. The scale and offset settings affect how the texture is positioned on a piece of geometry. The animation settings affect the speed and direction in which texture coordinates are animated.

For terrain shaders, the scale of the triplanar texture coordinates is controlled by the Texcoord scale setting.


See Also