the area that should be rock,there is grass.So is the rock area
here is my code:
in class MyShaderCallBack:public video::IShaderConstantSetCallBack
Code: Select all
coverage=2;
bool succ1=services->setPixelShaderConstant("coverage",(f32*)(&coverage),1);
lightmap=3;
bool succ2=services->setPixelShaderConstant("lightmap",(f32*)(&lightmap),1);
splat1=0;
bool succ3=services->setPixelShaderConstant("splat1",(f32*)(&splat1),1);
splat2=1;
bool succ4=services->setPixelShaderConstant("splat2",(f32*)(&splat2),1);
in the main function
Code: Select all
terrain->setMaterialTexture(0, driver->getTexture("media/terrain/splatting_grass.png"));
terrain->setMaterialTexture(1, driver->getTexture("media/terrain/splatting_rock.png"));
terrain->setMaterialTexture(2, driver->getTexture("media/test_coverage.bmp"));
terrain->setMaterialTexture(3, driver->getTexture("media/test_lightmap.bmp"));
Code: Select all
sampler2D coverage; //coverage
sampler2D lightmap; //lightmap
sampler2D splat1;
sampler2D splat2;