MaterialExamples

From Ogre Wiki

Jump to: navigation, search

Changing the alpha of the second texture (the 0.5 value is the amount)

material Overlay/TwoTextures 
{ 
  technique 
  { 
     pass 
     { 
              texture_unit 
              { 
                    texture_alias BaseTexture
                    texture texture1.png 
              } 
              texture_unit 
              { 
                    texture_alias MixTexture
                    texture texture2.png 
                    colour_op_ex blend_manual src_texture src_current 0.5 
              } 
      } 
  } 
}


c++ code:

     static_cast<MaterialPtr>( MaterialManager::getSingleton( ).getByName( "Overlay/TwoTextures" ) ) 
        ->getTechnique(0)->getPass(0)->getTextureUnitState("MixTexture")-> 
        setColourOperationEx(LBX_BLEND_MANUAL, LBS_TEXTURE, LBS_CURRENT, 1,1, add); 

// PB3: Was "(this code doesn't really correspond :|, could someone fix it?)", I did :) Personally I would clone the material first otherwise every object that uses this material would have the exact same mixing of the second texture.

Personal tools
administration