Suggestions for seamless water (w/ pic) (new problems)...
Suggestions for seamless water (w/ pic) (new problems)...
Basically, I have 6 different meshes that, together, create 1 large body of water.
The problem is that there is a hole (purposely put there) in the middle of this body of water, that goes beneath water-level. It's kinda like a "reverse well", where in a normal well, the water is in the well and not around the outside of it.
I've created and positioned the water nodes correctly, but the problem is that you can see the seams (bounds) for each mesh. What's the best approach for overcoming this?
See the image below. Any input is appreciated.
The problem is that there is a hole (purposely put there) in the middle of this body of water, that goes beneath water-level. It's kinda like a "reverse well", where in a normal well, the water is in the well and not around the outside of it.
I've created and positioned the water nodes correctly, but the problem is that you can see the seams (bounds) for each mesh. What's the best approach for overcoming this?
See the image below. Any input is appreciated.
Last edited by Rytz on Fri Sep 26, 2008 12:20 am, edited 1 time in total.
You need to play around with the E_TEXTURE_CLAMP parameter of the mesh's SMaterialLayer that uses that texture. It can be one of the following:
ETC_REPEAT Texture repeats.
ETC_CLAMP Texture is clamped to the last pixel.
ETC_CLAMP_TO_EDGE Texture is clamped to the edge pixel.
ETC_CLAMP_TO_BORDER Texture is clamped to the border pixel (if exists).
ETC_MIRROR Texture is alternatingly mirrored (0..1..0..1..0..).
It seems like you can do node->getMaterial(0).setFlag(EMF_TEXTURE_WRAP, ETC_REPEAT);
Try some different parameters to see which looks best, my bet would be either ETC_CLAMP or ETC_CLAMP_TO_EDGE
ETC_REPEAT Texture repeats.
ETC_CLAMP Texture is clamped to the last pixel.
ETC_CLAMP_TO_EDGE Texture is clamped to the edge pixel.
ETC_CLAMP_TO_BORDER Texture is clamped to the border pixel (if exists).
ETC_MIRROR Texture is alternatingly mirrored (0..1..0..1..0..).
It seems like you can do node->getMaterial(0).setFlag(EMF_TEXTURE_WRAP, ETC_REPEAT);
Try some different parameters to see which looks best, my bet would be either ETC_CLAMP or ETC_CLAMP_TO_EDGE
Thanks for the replies.
Will the IWaterSurfaceSceneNode follow the shape of the mesh that is bound to it or will the node always show up as a flat rectangle? If it follows any shape I guess I could create a mesh for the water that wraps all the way around the hole.
Is it possible to create one mesh for the entire "square" of the map and not have water show up where the hole is? That was my reasoning for creating 6 meshes instead of one big one, so that I could go "around" the hole.hybrid wrote:Could also be two overlapping transparent materials. Moreover, the problem is not the hole, but the surrounding, which is not just one mesh. Question is why you use several meshes instead of just one?
Will the IWaterSurfaceSceneNode follow the shape of the mesh that is bound to it or will the node always show up as a flat rectangle? If it follows any shape I guess I could create a mesh for the water that wraps all the way around the hole.
Ok, so I created a single mesh to enclose the "well" instead of 6, but now I've run into 2 other problems. The first one seems expected, the other does not.
[Problem #1]:
I'm not getting the "hill" effect that I was with the previous "6 mesh" method (I was using "addHillPlaneMesh" to create meshes for the water nodes). It's one flat surface that bounces up and down which you can't see in the image. It looks more like an icy surface.
[Problem #2]:
At certain angles, the water mesh is disappearing altogether. I don't have any other clues as to why, but here is the pic and the code I use to create it below:
[Problem #1]:
I'm not getting the "hill" effect that I was with the previous "6 mesh" method (I was using "addHillPlaneMesh" to create meshes for the water nodes). It's one flat surface that bounces up and down which you can't see in the image. It looks more like an icy surface.
[Problem #2]:
At certain angles, the water mesh is disappearing altogether. I don't have any other clues as to why, but here is the pic and the code I use to create it below:
Code: Select all
// create animated water mesh...
scene::IAnimatedMesh *meshNewWater = ptrClient->ptrVideo->dvWindow->getSceneManager()->getMeshManipulator()->createAnimatedMesh(
ptrClient->avatar->room->meshWater);
// create "top-down" / "over-water" water node...
scene::ISceneNode *nodeWaterOver = ptrClient->ptrVideo->dvWindow->getSceneManager()->addWaterSurfaceSceneNode(
meshNewWater, 2.0f, 200.0f, 20.0f, ptrClient->avatar->room->nodeRoom, -1,
ptrClient->avatar->room->meshWater->getBoundingBox().getCenter(),
core::vector3df(0, 0, 0),
core::vector3df(1.0f, 1.0f, 1.0f));
nodeWaterOver->setMaterialTexture(0, ptrClient->ptrVideo->irrVDriver->getTexture("./media/textures/water/water01.jpg"));
nodeWaterOver->setMaterialTexture(1, ptrClient->ptrVideo->irrVDriver->getTexture("./media/textures/water/water01.jpg"));
nodeWaterOver->setMaterialType(video::EMT_TRANSPARENT_REFLECTION_2_LAYER);
nodeWaterOver->setMaterialFlag(video::EMF_LIGHTING, false);
//nodeWaterOver->setMaterialFlag(video::EMF_TEXTURE_WRAP, true);
// create "bottom-up" / "under-water" water node...
scene::ISceneNode *nodeWaterUnder = ptrClient->ptrVideo->dvWindow->getSceneManager()->addWaterSurfaceSceneNode(
meshNewWater, 2.0f, 200.0f, 20.0f, ptrClient->avatar->room->nodeRoom, -1,
ptrClient->avatar->room->meshWater->getBoundingBox().getCenter(),
core::vector3df(180, 0, 0),
core::vector3df(1.0f, 1.0f, 1.0f));
nodeWaterUnder->setMaterialTexture(0, ptrClient->ptrVideo->irrVDriver->getTexture("./media/textures/water/water01.jpg"));
nodeWaterUnder->setMaterialTexture(1, ptrClient->ptrVideo->irrVDriver->getTexture("./media/textures/water/water01.jpg"));
nodeWaterUnder->setMaterialType(video::EMT_TRANSPARENT_REFLECTION_2_LAYER);
nodeWaterUnder->setMaterialFlag(video::EMF_LIGHTING, false);
//nodeWaterUnder->setMaterialFlag(video::EMF_TEXTURE_WRAP, true);
// drop the reference...
meshNewWater->drop();
I'll throw the mesh up for download when I get to work tomorrow but I'm guessing you're right that it's my mesh because the water node works fine when I use a mesh created from addHillPlaneMesh. It "waves" the way it should and I don't get the visibility problem.hybrid wrote:Looks like either your mesh has some problems, or the water scene node is not working as good as expected Can you upload your mesh somewhere such we have a fully working version for tests?
Are there any special requirements for a mesh that is to be used for a water scene node?
Thanks Eigen - setting the culling to off fixed my visibility issue.Eigen wrote:It's probably a culling issue. Try changing the node->setAutomaticCulling( ); to EAC_FRUSTUM_BOX or EAC_OFF to see if it works then.
Just one more issue to overcome... I'm getting a weird texture / tiling issue. I'm using the Ascii DirectX mesh format exported by DeleD Lite and the water mesh is a grid object that is 32x32. It only seems to happen when I use EMT_REFLECTION_2_LAYER or EMT_TRANSPARENT_REFLECTION_2_LAYER so it probably has something to do with reflection.
*WITHOUT* EMT_REFLECTION_2_LAYER
*WITH* EMT_REFLECTION_2_LAYER
In the bottom pic you can see that the "reflection" visuals aren't lining up. I found THIS thread on some problems with this format but not sure if it's the exact same problem. Any thoughts?