C3DMesh::SetMaterial |
Top Previous Next |
Syntax:
SetMaterial(D3DMATERIAL material)
Purpose: Sets the material values to use when rendering the mesh.
Parameters: material - A UDT of type D3DMATERIAL
Returned value(s): None.
Application: D3DMATERIAL mat
Class Hierarchy -------C3DMesh
Additional Info: Materials describe how polygons reflect light or appear to emit light in a 3-D scene. Material properties detail a material's diffuse reflection, ambient reflection, light emission, and specular highlight characteristics.
The Diffuse and Ambient members of the D3DMATERIAL UDT 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.
The Emissive member of the D3DMATERIAL UDT is used to describe the color and transparency 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.
Specular reflection creates highlights on objects, making them appear shiny. The D3DMATERIAL UDT contains two members that describe the specular highlight color as well as the material's overall shininess. You establish the color of the specular highlights by setting the Specular member to the desired RGBA color the most common colors are white or light gray. The values you set in the Power member control how sharp the specular effects are. |