EMT_SOLID_2_LAYER texture splatting?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Distorion
Posts: 12
Joined: Thu Jul 19, 2012 1:58 am
Location: Canberra, Australia

EMT_SOLID_2_LAYER texture splatting?

Post by Distorion »

Hey,
I have being messing around trying implement basic texture splatting without using any shaders, My idea was to use EMT_SOLID_2_LAYER and apply that to a terrainscenenode and then edit the vertex Alpha value to blend the two textures together.
I start by creating the terrain:

Code: Select all

 
p_Terrain = C_Editor::get_editor_Handle()->ip_smgr->addTerrainSceneNode(
        "heightmap.bmp");
 
    p_Terrain->setMaterialFlag(EMF_LIGHTING, false);
    p_Terrain->setMaterialTexture(0, texture1);
    p_Terrain->setMaterialTexture(1, texture2);
    p_Terrain->setMaterialType(EMT_SOLID_2_LAYER);
 
 
Then i modifie the vertex Alpha value:

Code: Select all

 
p_Vertices[Vertex].Color.setAlpha(Alpha -= 4); 
 
And then i drop and reload the images and apply them to the mesh again:

Code: Select all

 
    C_Editor::get_editor_Handle()->p_smgr->getVideoDriver()->removeTexture(texture1);
    C_Editor::get_editor_Handle()->p_smgr->getVideoDriver()->removeTexture(texture2);
 
        texture1 = C_Editor::get_editor_Handle()->p_smgr->getVideoDriver()->getTexture("terrain-texture.jpg");
    texture2 = C_Editor::get_editor_Handle()->p_smgr->getVideoDriver()->getTexture("terrain-texture2.jpg");
    
 
    p_Terrain->setMaterialTexture(0, texture1);
    p_Terrain->setMaterialTexture(1, texture2);
 
So far this hasn't worked at all, Am i on the wrong track?

Any help would be appreciated. Thank you for your time!
Post Reply