transparent water surface
transparent water surface
hi i'm new, how would i go about making the water surface node transparent so the water look better?
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
Have you looked at example 8 Special FX? Does it do what you want? If not, what do you want to do differently?
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
The special fx example shows how to create the water node (which I have already done). What I want to do is make the water node semi transparent so i can see whats under the water, sorta like real water. So all i need help with is the code which would make something transparent or have an alpha value.
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
Off the top of my head, replace this:
with this:
That'll give you a basic translucent layer, but then you'll lose the really pretty water FX. I'm not sure there's an out-of-the-box material type that'll give you both.
Code: Select all
node->setMaterialTexture(0, driver->getTexture("../../media/stones.jpg"));
node->setMaterialTexture(1, driver->getTexture("../../media/water.jpg"));
node->setMaterialType(video::EMT_REFLECTION_2_LAYER);
Code: Select all
node->setMaterialTexture(0, driver->getTexture("../../media/water.jpg"));
node->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
-
- Posts: 368
- Joined: Tue Aug 21, 2007 1:43 am
- Location: The Middle of Nowhere
Try EMT_TRANSPARENT_REFLECTION_2_LAYER, but note that it doesn't work 100% in OpenGL (irrlicht version 1.3.1)
http://irrlicht.sourceforge.net/docu/na ... .html#a158
http://irrlicht.sourceforge.net/docu/na ... .html#a158
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
Replace this:
with this
Where OPACITY is the degree of opacity, with 0 being transparent and 255 being solid.
Code: Select all
mesh = smgr->addHillPlaneMesh("myHill",
core::dimension2d<f32>(20,20),
core::dimension2d<u32>(40,40), 0, 0,
core::dimension2d<f32>(0,0),
core::dimension2d<f32>(10,10));
node = smgr->addWaterSurfaceSceneNode(mesh->getMesh(0), 3.0f, 300.0f, 30.0f);
node->setPosition(core::vector3df(0,7,0));
node->setMaterialTexture(0, driver->getTexture("../../media/stones.jpg"));
node->setMaterialTexture(1, driver->getTexture("../../media/water.jpg"));
node->setMaterialType(video::EMT_REFLECTION_2_LAYER);
Code: Select all
mesh = smgr->addHillPlaneMesh("myHill",
core::dimension2d<f32>(20,20),
core::dimension2d<u32>(40,40), 0, 0,
core::dimension2d<f32>(0,0),
core::dimension2d<f32>(10,10));
smgr->getMeshManipulator()->setVertexColorAlpha(mesh->getMesh(0), OPACITY);
node = smgr->addWaterSurfaceSceneNode(mesh->getMesh(0), 3.0f, 300.0f, 30.0f);
node->setPosition(core::vector3df(0,7,0));
node->setMaterialTexture(0, driver->getTexture("../../media/water.jpg"));
node->setMaterialType(video::EMT_TRANSPARENT_VERTEX_ALPHA);
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way