How can I get Irrlicht's built in water to be partially transparent?
This question has been asked before, but the suggested solution doesn't seem to work for me.
Here's my code
Code: Select all
const f32 waveHeight = 0.1;
const f32 waveSpeed = 1000.0;
const f32 waveLength = 2.5;
scene::ISceneManager *smgr = device->getSceneManager();
const f32 seaWidth = 50.f;
const f32 seaHeight = 200.f;
const f32 tileSize = 2.0;
const f32 textureScale = 3.0;
scene::IAnimatedMesh *meshWater = smgr->addHillPlaneMesh("waterHill",
core::dimension2df(tileSize,tileSize), // tile size
core::dimension2du( (u32)(seaWidth/tileSize), (u32)(seaHeight/tileSize) ), // tile count
0,0.01,// material and hill height, not used for water (want a flat plane)
core::dimension2df(seaWidth*0.1,seaHeight*0.1), // hill count. None for water.
core::dimension2df(seaWidth/textureScale,seaHeight/textureScale)); // x,y texture repeat
scene::IMesh *staticMeshWater = meshWater->getMesh(0);
smgr->getMeshManipulator()->setVertexColorAlpha(staticMeshWater, 100);
scene::ISceneNode *nodeWater = smgr->addWaterSurfaceSceneNode(staticMeshWater,
waveHeight, waveSpeed, waveLength);
nodeWater->setMaterialTexture(0, device->getVideoDriver()->getTexture("watersand.png"));
nodeWater->setMaterialTexture(1, device->getVideoDriver()->getTexture("water.jpg"));
nodeWater->setMaterialType(video::EMT_TRANSPARENT_REFLECTION_2_LAYER);
const f32 waterHeight = -0.4;
nodeWater->setPosition(core::vector3df(-seaWidth/2.0,waterHeight,0));
(ignore the character thing in the middle)
I notice in the docs it says "Please note that this material type is currently not 100% implemented in OpenGL". So perhaps that is the issue, it simply isn't implemented!? :S
I'm using OpenGL, Irrlicht 1.6
Using shader based water is out of the question for this project.