History: -Material
Preview of version: 13
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | 0-9
Material - A material determines how the surface of a {LEX()}mesh{LEX} will appear after being rendered. You can e.g. assign {LEX()}texture{LEX}s, set colours, enable lighting or {LEX()}shadow{LEX}-receiving as well as assigning {LEX()}shader{LEX}s.
Normally it's just visible from one side (e.g. surface of a {LEX()}mesh{LEX}), but this can be changed (e.g. for {LEX()}water{LEX} surfaces). Material properties can be defined by material files or by source code.
Transparency
If you have problems with transparency, look for some important material options.
- Set scene blend to alpha blend
- Disable depth write
Depth write can be turned off when rendering static backgrounds or when rendering a collection of transparent objects at the end of a scene so that they overlap each other correctly.
Apply in material script:
material TransparencyExample { technique { pass { //... scene_blend alpha_blend depth_write off } } }
Apply by code (C# example for Mogre):
myMaterialPtr.GetTechnique(0).GetPass(0).SetSceneBlending(SceneBlendType.SBT_TRANSPARENT_ALPHA); myMaterialPtr.GetTechnique(0).GetPass(0).DepthWriteEnabled = false;
See also
- Ogre::Material Class Reference
- Texture
- Collection of Ogre material templates
- Displaying 2D Backgrounds
- Line 3D / MOGRE Line 3D - includes some code how to create a material by code
- Projective Decals - dynamic texture projection on top of a terrain texture
- Reloading materials and parsing material scripts
- MadMarx Tutorial 7 - Basic Material (part 1)
- MadMarx Tutorial 8 - Basic Material (part 2), about transparency, decals, environment map, mix percentage
Ogre Manual:
- Materials
- Material Scripts
- Techniques
- Passes - Definition of colours, transparency, blending types, etc.
- Texture Units
- Script Inheritance
- Script Variables