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.

 

Emission

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.



Textures

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. You can see "bump" material in sample scene "Bump Text" for this usage. 
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

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

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

vector _vecLight; // position of light0
vector _vecLightColor; // color of light0
dword _dwLightColor; // color of light0
vector _vecLightParam; // parameters of light0 ( range*range, 0, 0, 0 )

vector _vecLight1 ~ _vecLight7; // position of light1 to light7
vector _vecLightColor1 ~ _vecLightColor7; // color of light1 to light7
dword _dwLightColor1 ~ _dwLightColor7; // color of light1 to light7
vector _vecLightParam1 ~ _vecLightParam7; // parameters of light1 to light7 ( range*range, 0, 0, 0 )


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 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

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.