Realistic water scene node

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki

Re: Realistic water scene node (updated)

Postby catafest » Sun Aug 14, 2011 7:45 pm

I try to use your class ...
I got this :
cpp Code: Select all
High level shader materials not available ( yet) in this driver, sorry

Can you tell me what is wrong ?
catafest
 
Posts: 2
Joined: Fri Jan 15, 2010 3:18 pm

Re: Realistic water scene node (updated)

Postby shadowslair » Sun Aug 14, 2011 8:54 pm

Maybe your machine is ancient or your drivers are obsolete as it`s not supporting shaders.
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
User avatar
shadowslair
 
Posts: 758
Joined: Mon Mar 31, 2008 3:32 pm
Location: Bulgaria

Re: Realistic water scene node (updated)

Postby polylux » Sun Aug 14, 2011 9:06 pm

As the msg suggests you use a driver that doesn't support shaders. I assume you use the software renderer. Change to OpenGL, D3D and the like.
Furthermore (and generally) provide more information than "It's not working, what's wrong?", makes it all easier to help.

p.
beer->setMotivationCallback(this);
User avatar
polylux
 
Posts: 251
Joined: Thu Aug 27, 2009 12:39 pm
Location: EU

Re: Realistic water scene node (updated)

Postby atul » Mon Aug 15, 2011 9:27 pm

Great scene node, I've just noticed one minor issue: in the OnAnimate method of the RealisticWaterSceneNode class the position of _camera (the camera from which the reflection will be rendered) is calculated in terms of the relative position of the current active camera, but shouldn't this be the absolute position of the current active camera, especially considering that the targets of the cameras are always given in absolute coordinates? This was giving me trouble because I had a camera set up as a child of a mesh and the reflections were looking very strange.

So in short the following line of code
cpp Code: Select all
core::vector3df position = currentCamera->getPosition();

should be changed to
cpp Code: Select all
core::vector3df position = currentCamera->getAbsolutePosition();
atul
 
Posts: 1
Joined: Mon Aug 15, 2011 9:16 pm

Re: Realistic water scene node (updated)

Postby nman » Wed Aug 24, 2011 5:48 pm

i am newbie in irrlicht, today i have been successfully create transparent water effect for lake or river with opengl but nothing object reflection effect. This my screenshoot below. Can anyone help me to add the reflection effect?
Image
nman
 
Posts: 1
Joined: Wed Aug 24, 2011 5:32 pm

Re: Realistic water scene node (updated)

Postby Donner » Sun Oct 09, 2011 6:03 pm

All the links seem to be dead... can someone post the latest version?
Thanks ;)
Donner
 
Posts: 87
Joined: Fri May 18, 2007 11:27 am

Re: Realistic water scene node (updated)

Postby elvman » Mon Oct 10, 2011 7:32 pm

Sorry, server is down for maintenance. It will be up in 2 days.
Ouzel – 2D game engine
Realistic water node
elvman
 
Posts: 253
Joined: Sun Sep 17, 2006 9:37 am
Location: Riga, Latvia

Re: Realistic water scene node (updated)

Postby SGH » Sun Oct 16, 2011 9:53 pm

Maybe a bit more than 2 days... o.O
SGH
 
Posts: 13
Joined: Wed Aug 24, 2011 2:53 pm

Re: Realistic water scene node

Postby elvman » Tue Oct 25, 2011 4:51 pm

Finally changed the URL of the scene node. Sorry!
Ouzel – 2D game engine
Realistic water node
elvman
 
Posts: 253
Joined: Sun Sep 17, 2006 9:37 am
Location: Riga, Latvia

Re: Realistic water scene node

Postby TerryRussell » Tue Oct 25, 2011 7:17 pm

Thank you!

I'll download it and give it a try.
Regards,

Terry
TerryRussell
 
Posts: 12
Joined: Wed Mar 30, 2011 7:14 pm

Re: Realistic water scene node

Postby Cube_ » Fri Nov 18, 2011 10:50 am

image links broken, please fix...

you know, no pix no clix
"this is not the bottleneck you are looking for"
User avatar
Cube_
 
Posts: 1011
Joined: Mon Oct 24, 2011 10:03 pm
Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d

Re: Realistic water scene node

Postby Virion » Sat Nov 19, 2011 4:35 pm

does this included in irrExt svn directories?
User avatar
Virion
Competition winner
 
Posts: 2140
Joined: Mon Dec 18, 2006 5:04 am

Re: Realistic water scene node

Postby Sinsemilla » Sun Feb 12, 2012 4:08 pm

Hi elvman,

Thirst of all you did a very nice work :D, i've tried out different water shaders and your's is fitting best to my project. Unfortunately i got a problem with it. When i am using Opengl in linux and windows, respectively GLSL, everything is running fine. When i am using direct3d, respectively HLSL in windows, i am getting a effect of blackened water. Only a circle around the camera has the correct colour. This circle is getting bigger when i am zooming back with the camera and smaller when i zoom to the water. Sorry for the noobish description without technical terms, i don't know anything about shaders... :oops:

Image

Besides of this i was running a valgrind check over my game in linux with the result of getting memory leaks from the water scene node. The valgrind output i am getting looks like this:
Invalid write of size 8
==26429==    at 0x42E565: irr::scene::ISceneNode::removeAll() (ISceneNode.h:323)
==26429==    by 0x42DAC0: irr::scene::ISceneNode::~ISceneNode() (ISceneNode.h:65)
==26429==    by 0x42CA00: RealisticWaterSceneNode::~RealisticWaterSceneNode() (RealisticWater.cpp:51)
==26429==    by 0x42CB29: RealisticWaterSceneNode::~RealisticWaterSceneNode() (RealisticWater.cpp:82)
==26429==    by 0x421378: RunGame::~RunGame() (RunGame.cpp:126)
==26429==    by 0x4214D3: RunGame::~RunGame() (RunGame.cpp:138)
==26429==    by 0x43C9EE: main (main.cpp:38)
==26429==  Address 0xde44ca8 is 136 bytes inside a block of size 504 free'd
==26429==    at 0x4C27FF2: operator delete(void*) (vg_replace_malloc.c:387)
==26429==    by 0x424C1B: irr::IReferenceCounted::drop() const (IReferenceCounted.h:124)
==26429==    by 0x42C971: RealisticWaterSceneNode::~RealisticWaterSceneNode() (RealisticWater.cpp:73)
==26429==    by 0x42CB29: RealisticWaterSceneNode::~RealisticWaterSceneNode() (RealisticWater.cpp:82)
==26429==    by 0x421378: RunGame::~RunGame() (RunGame.cpp:126)
==26429==    by 0x4214D3: RunGame::~RunGame() (RunGame.cpp:138)
==26429==    by 0x43C9EE: main (main.cpp:38)
==26429==
==26429== Invalid read of size 8
==26429==    at 0x42E57F: irr::scene::ISceneNode::removeAll() (ISceneNode.h:324)
==26429==    by 0x42DAC0: irr::scene::ISceneNode::~ISceneNode() (ISceneNode.h:65)
==26429==    by 0x42CA00: RealisticWaterSceneNode::~RealisticWaterSceneNode() (RealisticWater.cpp:51)
==26429==    by 0x42CB29: RealisticWaterSceneNode::~RealisticWaterSceneNode() (RealisticWater.cpp:82)
==26429==    by 0x421378: RunGame::~RunGame() (RunGame.cpp:126)
==26429==    by 0x4214D3: RunGame::~RunGame() (RunGame.cpp:138)
==26429==    by 0x43C9EE: main (main.cpp:38)
==26429==  Address 0xde44c20 is 0 bytes inside a block of size 504 free'd
==26429==    at 0x4C27FF2: operator delete(void*) (vg_replace_malloc.c:387)
==26429==    by 0x424C1B: irr::IReferenceCounted::drop() const (IReferenceCounted.h:124)
==26429==    by 0x42C971: RealisticWaterSceneNode::~RealisticWaterSceneNode() (RealisticWater.cpp:73)
==26429==    by 0x42CB29: RealisticWaterSceneNode::~RealisticWaterSceneNode() (RealisticWater.cpp:82)
==26429==    by 0x421378: RunGame::~RunGame() (RunGame.cpp:126)
==26429==    by 0x4214D3: RunGame::~RunGame() (RunGame.cpp:138)
==26429==    by 0x43C9EE: main (main.cpp:38)
==26429==
==26429== Invalid read of size 4
==26429==    at 0x424BE6: irr::IReferenceCounted::drop() const (IReferenceCounted.h:121)
==26429==    by 0x42E593: irr::scene::ISceneNode::removeAll() (ISceneNode.h:324)
==26429==    by 0x42DAC0: irr::scene::ISceneNode::~ISceneNode() (ISceneNode.h:65)
==26429==    by 0x42CA00: RealisticWaterSceneNode::~RealisticWaterSceneNode() (RealisticWater.cpp:51)
==26429==    by 0x42CB29: RealisticWaterSceneNode::~RealisticWaterSceneNode() (RealisticWater.cpp:82)
==26429==    by 0x421378: RunGame::~RunGame() (RunGame.cpp:126)
==26429==    by 0x4214D3: RunGame::~RunGame() (RunGame.cpp:138)
==26429==    by 0x43C9EE: main (main.cpp:38)
==26429==  Address 0xde44e10 is 496 bytes inside a block of size 504 free'd
==26429==    at 0x4C27FF2: operator delete(void*) (vg_replace_malloc.c:387)
==26429==    by 0x424C1B: irr::IReferenceCounted::drop() const (IReferenceCounted.h:124)
==26429==    by 0x42C971: RealisticWaterSceneNode::~RealisticWaterSceneNode() (RealisticWater.cpp:73)
==26429==    by 0x42CB29: RealisticWaterSceneNode::~RealisticWaterSceneNode() (RealisticWater.cpp:82)
==26429==    by 0x421378: RunGame::~RunGame() (RunGame.cpp:126)
==26429==    by 0x4214D3: RunGame::~RunGame() (RunGame.cpp:138)
==26429==    by 0x43C9EE: main (main.cpp:38)
==26429==
==26429== Invalid write of size 4
==26429==    at 0x424BF0: irr::IReferenceCounted::drop() const (IReferenceCounted.h:121)
==26429==    by 0x42E593: irr::scene::ISceneNode::removeAll() (ISceneNode.h:324)
==26429==    by 0x42DAC0: irr::scene::ISceneNode::~ISceneNode() (ISceneNode.h:65)
==26429==    by 0x42CA00: RealisticWaterSceneNode::~RealisticWaterSceneNode() (RealisticWater.cpp:51)
==26429==    by 0x42CB29: RealisticWaterSceneNode::~RealisticWaterSceneNode() (RealisticWater.cpp:82)
==26429==    by 0x421378: RunGame::~RunGame() (RunGame.cpp:126)
==26429==    by 0x4214D3: RunGame::~RunGame() (RunGame.cpp:138)
==26429==    by 0x43C9EE: main (main.cpp:38)
==26429==  Address 0xde44e10 is 496 bytes inside a block of size 504 free'd
==26429==    at 0x4C27FF2: operator delete(void*) (vg_replace_malloc.c:387)
==26429==    by 0x424C1B: irr::IReferenceCounted::drop() const (IReferenceCounted.h:124)
==26429==    by 0x42C971: RealisticWaterSceneNode::~RealisticWaterSceneNode() (RealisticWater.cpp:73)
==26429==    by 0x42CB29: RealisticWaterSceneNode::~RealisticWaterSceneNode() (RealisticWater.cpp:82)
==26429==    by 0x421378: RunGame::~RunGame() (RunGame.cpp:126)
==26429==    by 0x4214D3: RunGame::~RunGame() (RunGame.cpp:138)
==26429==    by 0x43C9EE: main (main.cpp:38)
==26429==
==26429== Invalid read of size 4
==26429==    at 0x424BF7: irr::IReferenceCounted::drop() const (IReferenceCounted.h:122)
==26429==    by 0x42E593: irr::scene::ISceneNode::removeAll() (ISceneNode.h:324)
==26429==    by 0x42DAC0: irr::scene::ISceneNode::~ISceneNode() (ISceneNode.h:65)
==26429==    by 0x42CA00: RealisticWaterSceneNode::~RealisticWaterSceneNode() (RealisticWater.cpp:51)
==26429==    by 0x42CB29: RealisticWaterSceneNode::~RealisticWaterSceneNode() (RealisticWater.cpp:82)
==26429==    by 0x421378: RunGame::~RunGame() (RunGame.cpp:126)
==26429==    by 0x4214D3: RunGame::~RunGame() (RunGame.cpp:138)
==26429==    by 0x43C9EE: main (main.cpp:38)
==26429==  Address 0xde44e10 is 496 bytes inside a block of size 504 free'd
==26429==    at 0x4C27FF2: operator delete(void*) (vg_replace_malloc.c:387)
==26429==    by 0x424C1B: irr::IReferenceCounted::drop() const (IReferenceCounted.h:124)
==26429==    by 0x42C971: RealisticWaterSceneNode::~RealisticWaterSceneNode() (RealisticWater.cpp:73)
==26429==    by 0x42CB29: RealisticWaterSceneNode::~RealisticWaterSceneNode() (RealisticWater.cpp:82)
==26429==    by 0x421378: RunGame::~RunGame() (RunGame.cpp:126)
==26429==    by 0x4214D3: RunGame::~RunGame() (RunGame.cpp:138)
==26429==    by 0x43C9EE: main (main.cpp:38)

These lines (126 - 138) are located at my RunGame.cpp destructor, 126 shows where i am deleting the object:
cpp Code: Select all
 
if (m_pWater != NULL) {
        delete m_pWater;
        m_pWater = NULL;
}
 


I used a member pointer for RealicWaterSceneNode since it has to be allocated on the heap as as showed in the example:
cpp Code: Select all
 
m_pWater = new RealisticWaterSceneNode(m_pSceneMgr, (MAP_SCALE * MAP_CHUNK_SIZE) * 3, (MAP_SCALE * MAP_CHUNK_SIZE) * 3, m_pDriver->getTexture("./graphics/data/waterbump.png"),
                                               dimension2du(m_pGameData->WaterQuality, m_pGameData->WaterQuality), m_pSceneMgr->getRootSceneNode(), -1);
 


If i take a look at the decumentation of the functions in RealisticWater.cpp i see following:
This pointer should not be dropped. See IReferenceCounted::drop() for more information.

When i empty the destructor of RealisticWater.cpp i am getting no erros from valgrind anymore.

Sorry for my potentially bad english and nice work anyways :D
Greets Sinsemilla
Sinsemilla
 
Posts: 36
Joined: Mon Jan 09, 2012 5:07 pm

Re: Realistic water scene node

Postby mss » Fri Nov 30, 2012 9:56 pm

For me, the OPENGL rendering doesn't reflect anything and it doesn't do any transparency effect. For DX9, it works seemingly well, it pulls colors from the edges a little odd, but it's much better than the OPENGL shaders.

My sympathies for having the balls to dig into shaders. They're not the easiest things to work with.
mss
 
Posts: 24
Joined: Mon Oct 29, 2012 6:41 pm

Re: Realistic water scene node

Postby ikam » Thu Dec 27, 2012 9:47 pm

Hi

nice water node, works fine, thanks.

to fix opengl shader with 1.8 replace this code in RealisticWater.cpp :

cpp Code: Select all
services->setPixelShaderConstant("WaterBump", (float*)(&var0), 1); //the colormap
services->setPixelShaderConstant("RefractionMap", (float*)(&var1), 1); //the colormap
services->setPixelShaderConstant("ReflectionMap", (float*)(&var2), 1); //the colormap


with

cpp Code: Select all
services->setPixelShaderConstant("WaterBump", &var0, 1); //the colormap
services->setPixelShaderConstant("RefractionMap", &var1, 1); //the colormap
services->setPixelShaderConstant("ReflectionMap", &var2, 1); //the colormap
Werkkzeug4 Community Edition : http://werkkzeug4ce.blogspot.com/
ikam
 
Posts: 45
Joined: Sun Jun 24, 2007 4:46 pm
Location: France

PreviousNext

Return to Project Announcements

Who is online

Users browsing this forum: No registered users and 1 guest

cron