Material Properties


Material properties detail a material's diffuse reflection, ambient reflection, light emission, and specular highlight characteristics.


Diffuse and Ambient Reflection

The Diffuse and Ambient describe how a material reflects the ambient and diffuse light in a scene. Because most scenes contain much more diffuse light than ambient light, diffuse reflection plays the largest part in determining color. Additionally, because diffuse light is directional, the angle of incidence for diffuse light affects the overall intensity of the reflection. Diffuse reflection is greatest when the light strikes a vertex parallel to the vertex normal. As the angle increases, the effect of diffuse reflection diminishes.

Ambient reflection is nondirectional. Ambient reflection has a lesser impact on the apparent color of a rendered object, but it does affect the overall color and is most noticeable when little or no diffuse light reflects off the material. A material's ambient reflection is affected by the ambient light set for a scene. Awakening's ambient light is set to 0xFFFFFFFF ( full white ), so material's Ambient color is object's rendered color when no diffuse light.



Materials can be used to make a rendered object appear to be self-luminous. The Emissive is used to describe the color of the emitted light. Emission affects an object's color and can, for example, make a dark material brighter and take on part of the emitted color.

You can use a material's emissive property to add the illusion that an object is emitting light, without incurring the computational overhead of adding a light to the scene. Remember, materials with emissive properties don't emit light that can be reflected by other objects in a scene. To achieve this reflected light, you need to place an additional light within the scene.


Specular Reflection

Specular reflection creates highlights on objects, making them appear shiny. Specular Reflection contains two parameters that describe the specular highlight color as well as the material's overall shininess. Specular control the color of the specular highlights - the most common colors are white or light gray. Power control how sharp the specular effects are.

Specular highlights can create dramatic effects. To make an object truly matte, set Power to zero and Specular to black. Experiment with different levels of reflection to produce a realistic appearance for your needs.


Shade Mode

The shading mode used to render a polygon has a profound effect on its appearance. Shading modes determine the intensity of color and lighting at any point on a polygon face. Awakening supports two shading modes: Flat Shading and Gouraud Shading.

In the Flat Shading mode, Awakening renders a polygon, using the color of the polygon material at its first vertex as the color for the entire polygon. 3-D objects that are rendered with flat shading have visibly sharp edges between polygons if they are not coplanar.

When Awakening renders a polygon using Gouraud shading, it computes a color for each vertex by using the vertex normal and lighting parameters. Then, it interpolates the color across the face of the polygons The interpolation is done linearly. For example, if the red component of the color of vertex 1 is 0.8 and the red component of vertex 2 is 0.4, the Awakening lighting module assigns a red component of 0.6 to the pixel at the midpoint of the line between these vertices.


A material have eight layers of texture. Commonly, most of materials only use one layer or none; to use more than one layer, you need combine using Shader Text.  In Awakening, 3d objects also have own one layer texture. Click in Texture Panel to assign own texture for selected objects. When object's own texture is not NONE(null texture), material's first texture will be replaced at rendering; in other words, when rendering, program will first try to search object's own texture, if it's NONE, then use material's texture. This flexible setting let you no need to design dozens of similar material.


Shader Text

Shader Text is codes of DirectX Effect. Shader Text let you deeply control rendering. For more details, see D3D Effects. To use texture in Shader Text, first declare as this: " texture tTXn " . Here, 'n' is 0 - 7, express corresponding eight layers of texture.
Here are preset parameters, their values are feeded by system:

matrix matWorld; //World Matrix
matrix matView; //View Matrix
matrix matProj; //Projection Matrix
matrix matTotal; //matWorld*matView*matProj;
matrix matWorldView; //matWorld*matView
matrix matViewProj; //matView*matProj
matrix matWorldInv; //Inverse World Matrix
matrix matViewInv; //Inverse View Matrix
matrix matProjInv; //Inverse Projection Matrix

matrix matShadowViewProj; // matView*matProj for shadow projection

vector _vecEye; // the Eye Position (eye.x, eye.y, eye.z, 1), in world space
vector _vecBackBufDesc; // back buffer description (width, height, NearClip, FarClip)
vector _vecViewport; // viewport description ( vp.X, vp.Y, vp.Width, vp.Height )
vector _vecAppTime; // app time ( FrameTime, ElapsedTimeFromLastFrame, 0, 0 )

bool _bBlendPass; // indicates whether in Blend Pass rendering. Sometimes, expecially for dynamic lights, object needs multi-pass rendering.
// It first render one normally pass, then turn on Alpha Blending(One,One), and set Shader's "_bBlendPass" to true, render additional Blend Passes.

vector _vecUserData; // if root's userdata is not whole zero, this is valid.

If object has '
bump' style, there are below preset parameters:

vector _vecLight; // xyz: position of light0, in world space, w: falloff(SW Bias)
vector _vecLightColor; // xyz: color of light0, w: inner angle(NBias)
dword _dwLightColor; // color of light0
vector _vecLightParam; // parameters of light0 ( range*range, Attenuation0, Attenuation1, Attenuation2 )
vector _vecLightDir; // xyz: direction of light0, in world space, w: Cos(OuterAngle) , <0: point, ==0: directional, >0: spot
vector _qLightDir; // Quaternion express of light direction, only for Spot light.

vector _vecLight1 ~ _vecLight7; // position of light1 to light7, in world space, also SW Bias in w
vector _vecLightColor1 ~ _vecLightColor7; // color of light1 to light7, also NBias in w
dword _dwLightColor1 ~ _dwLightColor7; // color of light1 to light7
vector _vecLightParam1 ~ _vecLightParam7; // parameters of light1 to light7 ( range*range, Attenuation0, Attenuation1, Attenuation2 )
vector _vecLightDir1 ~ _vecLightDir7; //  direction info of light1 to light7
vector _qLightDir1 ~ _qLightDir7; // Quaternion express of light direction, only for Spot light.

// alternatively, you can use below light parameters
int _nLightNum; // the count of actived lights
vector _vLightPos[8]; // the light position array { x,y,z, range }
vector _vLightColor[8]; // the light color array
vector _vLightParam[8]; // the light parameters array
vector _vLightDir[8]; // the light direction array
vector _qLightDir[8]; // the light direction(quaternion) array, only valid for Spot light

// also, for material setting
bool _bSpecularEnable; // whether enable specular lighting
float _fSpecularPower; // specifying the sharpness of specular highlights

vector _vSpecularColor; // material's specular color
vector _vDiffuseColor; // material's diffuse color
vector _vAmbientColor; // material's ambient color
vector _vEmissiveColor; // material's emissive color

For bumped mobiles, there are also below preset parameters:

vector _vecObjPosition; // position of mobile object (in world space)

Even more, you can insert Vertex/Pixel Shader Assembly into shader text. Below is object vertex FVF list:

Object FVF
Surface XYZ | TEX2
Static Mesh XYZ | DIFFUSE | TEX1
Mobile, Cloth, Terrain XYZ | NORMAL | TEX1
Skin Mesh ( 0 weight  ) XYZB1 | LASTBETA_UBYTE4 | NORMAL | TEX1
Skin Mesh ( 1 weight  ) XYZB2 | LASTBETA_UBYTE4 | NORMAL | TEX1
Skin Mesh ( 2 weights) XYZB3 | LASTBETA_UBYTE4 | NORMAL | TEX1
Skin Mesh ( 3 weights) XYZB4 | LASTBETA_UBYTE4 | NORMAL | TEX1
Particle XYZ | DIFFUSE | TEX1
Billboard XYZ | DIFFUSE | TEX1

Material Factor:
You can define a
    vector __vFactor;
in your shader text, then Material's Factor values will feed to it when rendering.

Also see Shader Text - Multi-Techniques.

Texture Play

Texture Play is a serial of textures that apply to material in turn at runtime. This technique generally is used to simulate fire, water, etc. The texture in Texture Play will replace the first layer texture when rendering. See "water" material in sample scene "water" for explicit usage of Texture Play.

Dynamic Shadows

A material can have it's Source Shadow Material, Dest Shadow Material, and Depth Material.