MaterialExamples         Material script examples
Print

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.

 


Contributors to this page: jacmoe111451 points  and Flaschengeist .
Page last modified on Saturday 02 of January, 2010 05:39:57 GMT by jacmoe111451 points .


The content on this page is licensed under the terms of the Creative Commons Attribution-ShareAlike License.
As an exception, any source code contributed within the content is released into the Public Domain.