Documentation/Articles/Overview of Material Editor

From NeoAxis 3D Engine Wiki

Jump to: navigation, search
Go to higher level

Contents

Overview

Material Editor is a part of the Resource Editor which you will use to setup materials. A Material determines the settings that will be used to render a 3D model, such as the various textures maps and the shader parameters. Materials are stored in files with the extension .highMaterial.

Resource Editor

If you want to edit a material, you need to double-click it in the resource tree, or right click on it and select Edit in the context menu.

MaterialEditor 002.jpg

Material Creation

MaterialEditor 003.jpg

To create a new material, you need to right click on the desired folder, and select New -> Material in the context menu. Specify the name and type of the material in the opened window.

Available types of materials:

  • ShaderBaseMaterial — The basic type of material. Used for most needs.
  • FPSWeaponMaterial — This material is used to render models that are close to the camera. The peculiarity of this material is that models using such material will never penetrate other objects. Such material should be used for weapons and arms models in first-person mode.
  • VegetationMaterial — This material is intended to be used for grass and trees. With it, it's possible to simulate wind animation.
  • SimpleExampleMaterial — Example of creation of a new type of material. Support only the diffuse texture setting.
MaterialEditor 004.jpg

When the material has been created, you need to double-click on the material file you have created in order to edit it.

Created material

Material Parameters

Parameters of material like ShaderBaseMaterial will be explained below. This type of material is used in most cases. Furthermore, it is a base for some of the other types, which will be described below.

Basic Parameters

Basic information about the material is placed in the _General settings group:

Function Description
_General
DataSource Source of data. Indicates a file type .modelImport, if the material is obtained by importin models using intermediate format. If this parameter is set, then the material will be automatically updated when the source file will change.
Name Material name. Can't be edited. If you want to change the name of the material, you need to rename the file in resources tree.
Template Type of material, specified when created. Can't be edited.

General Material Parameters

You can configure the general settings of the material such as transparency, lighting calculation options, shadows and others with this group of parameters. These parameters can be found in the _ShaderBase group.

Function Description
_ShaderBase
AllowFog If set on False, the material will not be affected by fog if it is used in the scene.
AlphaRejectFunction Turn on / off drawing of pixels depending on the value of the alpha channel in the texture. AlwaysPass by default, i.e. always allow rendering. Used in conjunction with AlphaRejectValue. This feature allows you to add transparency to the material without reducing performance. Another way to create a transparent material is to use Blending to set up mixing.
AlphaRejectValue The alpha value for discarding pixels. Used in conjunction with AlphaRejectFunction.
AlphaToCoverage Enable / disable Alpha To Coverage to render transparent objects. Option allows you to improve the visual quality when configured along withAlphaRejectFunction. This feature only works when the Hardware Anti-Aliasing is turned on, which can be configured in the Configurator.
Blending Method of mixing at rendering. Opaque - opaque material, AlphaAdd - additive blending, AlphaBlend - the transparency value is taken from the alpha channel of the diffuse texture.
DepthOffset The added value with entries in the depth buffer. Used to avoid Z-fighting.
DepthTest Enable / disable depth testing.
DepthWrite Enable / Disable the depth buffer when drawing geometry.
DoubleSided Enable / disable double sided material. If True is selected, then the material is applied on both sides of the triangles.
FadingByDistanceRange Allows you to hide the object with this material when you move the camera at a certain distance. The parameter is defined as an interval. The initial value is determined by the distance when the object must be hidden. Final - at what distance the object becomes completely transparent.
HalfLambert Enable / disable the Half Lambert lighting technique.
Lightning Enable / disable the fact that the material is affected by lighting.
ReceiveShadows Enable / disable drawing shadows on models with this material.
ReceiveSimpleShadows Enable / disable drawing shadows on simplified models with this material.
SoftParticles Turn on / off drawing technique of soft particles.
SoftParticlesFadingLength Attenuation length of soft particles. Used in conjunction with SoftParticles.
UseNormals Consider or not consider triangle normals when calculating lighting. Recommended to disable this flag for grass, so the triangles wii be uniformly illuminated.

Parameters of Diffuse Color

MaterialEditor 006.jpg

Group Diffuse sets the diffuse color. Supports up to 4 diffuse textures.

Function Description
Diffuse
Diffuse1Map, Diffuse2Map, Diffuse3Map, Diffuse4Map Diffuse texture. You can configure the blending mode of the textures with advanced settings of mixing.
DiffuseColor Diffuse color. If no texture file is selected the parameter specifies the color of the material.
DiffusePower Modifier of diffuse color.
DiffuseScaleDynamic Enable/disable the ability to dynamically change the DiffuseColor parameter during simulation.
DiffuseVertexColor Enable/disable the use of vertex color. A vertex color channel must be present on the 3D model in order to use it.

Self-Luminosity Parameters

MaterialEditor 007.jpg

It's possible to create self illuminated materials with the Emission group settings.

Function Description
Emission
EmissionColor Colour of the emission.
EmissionMap Luminosity map.
EmissionPower Modifier of EmissionColor.
EmissionScaleDynamic Enable/disable the ability to dynamically change the EmissionColor parameter during the simulation.

Parameters of Normal's and Heights Map

MaterialEditor 008.jpg

Relief effect on the surface can be achieved with normal and/or heightmaps, which can be set in the Height group.

Function Description
Height
DisplacementTechnique Displacement technique used. You can select between the ParallaxOcclussionMapping and ParallaxMapping parameters.
HeightFromNormalMapAlpha Enable/disable ogetting the height value from the alpha channel of the normal map.
HeightMap HeightMap.
HeightScale Modifier height. Defines the maximal value of possible height.
NormalMap Normal map.

Reflection Parameters

MaterialEditor 009.jpg

Reflection Cubemap group allows to add reflection to the material, with a cubemap that has been previously generated.The creation of a cubemap texture is done in the Map Editor with the help of CubemapZone.type.

Function Description
Reflection Cubemap
ReflectionColor Color of reflection.
ReflectionMap Mask/stencil for applying reflection maps.
ReflectionPower Modifier for ReflectionColor.
ReflectionScaleDynamic Enable/disable the ability to dynamically change the ReflectionColor parameter during the simulation.
ReflectionSpecificCubemap Special cubemap for reflection. If this parameter is not specified, then the global reflection map will be used.

Parameters of the Reflected Light

MaterialEditor 010.jpg

Glare or specular reflection usually appears as a bright spot of light that appears on shiny objects. Glare is configured in the Specular group.

Function Description
Specular
SpecularColor Specular Color.
SpecularMap SpecularMap.
SpecularPower Brightness of the specular reflection.
SpecularScaleDymanic Enable/disable the ability to dynamically change the SpecularColor parameter during the simulation.
SpecularShininess Gloss power (scattering angle).

Translucency Parameters

MaterialEditor 011.jpg

The Translucency group of parameters allows you to set translucency for the material, for example, to simulate translucent tree leaves in the light.

Function Description
Translucency
TranslucencyClearness Purity of the translucency.
TranslucencyColor Color, which is multiplied by the color of the TranslucencyMap.
TranslucencyDynamic Enable/disable the ability to dynamically change the translucency during the simulation.
TranslucencyMap Mask to apply translucency.
TranslucencyPower Modifier of TranslucencyColor.

Advanced Maps Parameters

MaterialEditor 012.jpg

Advanced settings are available for all maps (Diffuse, Specular, Emission, Height, etc.). They allow you to configure the calculation methods for texture coordinates, including the ability to set up texture animation.

Function Description
Clamp Enable/disable limit for texture coordinates, if the value of texture coordinates is less than 0 or greater than 1.
TexCoord Texture coordinates Channel that will be used when overlaying the texture.
Texture The name of the texture file.

Transformation

Function Description
Transform
Animation Animation settings of the map. Click here for detalis below.
DynamicParameters Enable/disable the ability to change the transformation parameters during simulation.
Rotate The angle of the texture rotation.
Scale Scaling textures X and Y.
Scroll Offset texture on axes X and Y.

Animation

You can set the animation texture with the Animation group settings.

Function Description
Animation
RotateSpeed The rotation speed of the texture. Positive value texture rotates counterclockwise, negative - clockwise.
ScrollRound Step scroll texture. It can be used to create the animation, when the texture is full of images and it needd to be scrolled. This technique is like a slide show. You can for example implement an explosion animation with the help of this feature.
ScrollSpeed The scrolling speed of the texture.

Additional Types of Materials

In addition to ShaderBaseMaterial, there are other types of materials.

VegetationMaterial

MaterialEditor 013.jpg

VegetationMaterial type is based on ShaderBaseMaterial and is used for trees or other vegetation. This type allows you to set the animation swinging in the wind. You can find the settings in the Vegetation group.

Name Description
Vegetation
BendFrequency Frequency of bending animation.
BendScale Scale of the bending.
BendVariation Variation of the bending.
BranchAmplitude Amplitude of the branch.
BranchFrequency Frequency of the branch.
DetailBending Enable/disable bending.
LeafAmplitude Amplitude of the leaf.
LeafFrequency Frequency of the leaf.
ReceiveObjectsPositionsFromVertices Enable/disable receiving the object positions from the vertices. You need to enable this option if the 3D model with this material is used in DecorativeObjectManager.type.
WindEffectFactor Coefficient of wind effect.

FPSWeaponMaterial

Type FPSWeaponMaterial based on ShaderBaseMaterial is intended for objects that need to be drawn on top of the other, even if the latter ones are closer. This material is necessary for rendering weapons and arms for the first person view.

This type of material does not contain any special settings.

SimpleExampleMaterial

SimpleExampleMaterial is an example of creating new types of materials. This type allows you to configure only the diffuse texture.


Name Description
SimpleExampleMaterial
DiffuseMap The path to the diffuse texture.

Editor Configuration

Editor configuration of the materials are in the tab of window materials Material which can be opened from the main menu Tools -> Options or press the button Options on the toolbar.

MaterialEditor 016.jpg

General Settings

Name Description
General
Background Color General background color in the editor. The background color is only visible if the sky is off in the editor (parameter Sky Box).
Preview Mesh Name Path to the 3D model on which the material will be applied in the editor.
Show Axes Enable/disable the display of the coordinate axes to facilitate orientation in space.
Show Grid Enable/disable displaying the grid.
Sky Box Skybox (sky), which will be displayed as the background when viewing editable materials.

Settings of the Light Sources

In addition to the general settings you can change the properties of light sources. You can use three sources.

Name Description
Light
Light Diffuse Color Diffuse light of the source color.
Light Position Position of the light source.
Light Specular Color Color of the reflected light from the light source.

In addition to the settings of the three light sources it is available to configure the lighting environment.

Name Description
Light Ambient
Ambient Light Color Brightness of the environment.