OGRE Manual v1.8 ('Byatis'): 2.7 Materials

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

## 2.7 Materials

The Material object controls how objects in the scene are rendered. It specifies what basic surface properties objects have such as reflectance of colours, shininess etc, how many texture layers are present, what images are on them and how they are blended together, what special effects are applied such as environment mapping, what culling mode is used, how the textures are filtered etc.

Materials can either be set up programmatically, by calling SceneManager::createMaterial and tweaking the settings, or by specifying it in a 'script' which is loaded at runtime. See section Material Scripts for more info.

Basically everything about the appearance of an object apart from it's shape is controlled by the Material class.

The SceneManager class manages the master list of materials available to the scene. The list can be added to by the application by calling SceneManager::createMaterial, or by loading a Mesh (which will in turn load material properties). Whenever materials are added to the SceneManager, they start off with a default set of properties; these are defined by OGRE as the following:

- ambient reflectance = ColourValue::White (full)

- diffuse reflectance = ColourValue::White (full)

- specular reflectance = ColourValue::Black (none)

- emissive = ColourValue::Black (none)

- shininess = 0 (not shiny)

- No texture layers (& hence no textures)

- SourceBlendFactor = SBF_ONE, DestBlendFactor = SBF_ZERO (opaque)

- Depth buffer checking on

- Depth buffer writing on

- Depth buffer comparison function = CMPF_LESS_EQUAL

- Culling mode = CULL_CLOCKWISE

- Ambient lighting in scene = ColourValue(0.5, 0.5, 0.5) (mid-grey)

- Dynamic lighting enabled

- Gourad shading mode

- Solid polygon mode

- Bilinear texture filtering

You can alter these settings by calling SceneManager::getDefaultMaterialSettings() and making the required changes to the Material which is returned.

Entities automatically have Material's associated with them if they use a Mesh object, since the Mesh object typically sets up it's required materials on loading. You can also customise the material used by an entity as described in Entities. Just create a new Material, set it up how you like (you can copy an existing material into it if you like using a standard assignment statement) and point the SubEntity entries at it using SubEntity::setMaterialName().

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

This document was generated by David Rogers on May, 26 2012 using texi2html 1.70.