Realistic water scene node

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
Post Reply
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Post by christianclavet »

Thanks Elvman.

I'll try to incorporate your new version in my demo and will post new screenshots...
james
Posts: 6
Joined: Mon Aug 27, 2007 10:39 pm

Post by james »

I'm trying to implement this node (good job by the way) into irrlicht but need some help with the decleration in CSceneManager.cpp and CSceneManager.h.
Could someone show me how those functions would be set up in those files, i'd really appreciate it.

And by the way, good job on this node, after I get it setup and running i'll for sure give the author credit!
Strong99
Admin
Posts: 687
Joined: Fri Mar 31, 2006 7:06 pm
Location: Netherlands
Contact:

Post by Strong99 »

i think i got a bug, when i have the water against a wall and i looking from behind that wall to the water it reflects the wall in total, over the full length of the water node. The player Y pos is below the water nodes Y pos. so the water reflects only the wall color. instead everything else.
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Post by christianclavet »

Hi, I have updated the new code in my demo. For me my water look the same as it was. It's still look good. 8)

I still see the problem in the Pixel Shader code. The Fresnel effect is ok, but only if your camera is pointing it's heading a 0 degrees, if the camera rotate left or right, the fresnel effect is wrong. Modified the shader again to show the refraction correctly.

This water node seem only to work for the moment in DIRECTX only, openGL seem to have some problem in the shader code. (My water was black and not moving)

I had made a stupid mistake :oops: last time. Put the water declaration BEFORE the camera definition that made the demo crash because of the GetFOV(); I my previous version, I modified the water node source and declared them manually (Bad because I have a zoom feature in my demo). Simply made the declaration after the camera definition and all is ok now.

Since some people seem to have problem integrating the code in their programs, I've put my adapted working version for Irrlicht 1.3.1 in a linked archive to download.

Also added the updating of the reflection and refraction camera FOV and distance because I had a zoom function in my demo and it was not updated. Now it work perfect.

Here is a link to the modified source: http://www.clavet.org/files/Realistic_WaterCC.zip
I've also put an example code for calling the water node in the archive.
It should work directly in Irrlicht 1.3.1.

A big thank to Evlman for this node. It's really well done. :D
elvman
Posts: 253
Joined: Sun Sep 17, 2006 9:37 am
Location: Riga, Latvia
Contact:

Post by elvman »

Can I take some peaces of your code and integrate in the Realistic Water Scene Node (haven't looked at it yet)? I will add your name to the credits.
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Post by christianclavet »

Thanks Elvman, but you deserve the merit. :wink:

I only added 2 lines in "On Animate", (copied the 2 lines to get the camera FOV and Depth that you put in the first declaration.) Now it's updated when animated. That was very simple to do.

For the pixel shader. This is only there waiting that the heading problem that affect the Fresnel effect be fixed. (Hiding most of the fresnel effect while someone found the problem).

The only other things I've done is adapting the code to Irrlicht 1.3.1. and converting the DDS file to PNG. Also put a more detailed example for using your new addons feature that you implemented. (Watercolor)

What version of Irrlicht do you use? It's a tester version?
elvman
Posts: 253
Joined: Sun Sep 17, 2006 9:37 am
Location: Riga, Latvia
Contact:

Post by elvman »

I only added 2 lines in "On Animate", (copied the 2 lines to get the camera FOV and Depth that you put in the first declaration.) Now it's updated when animated. That was very simple to do.
That was already done in the last version of RWSN :)
G3LO
Posts: 16
Joined: Mon Aug 20, 2007 10:37 am
Location: Poland

Post by G3LO »

I would like to use this node but when i try i encounter this problem:
GLSL shader failed to compile
ERROR: 0:39: `f`: syntax error parse error
ERROR: 1 compilation errors. No code generated :(

besides in code fragment

Code: Select all

	WaterSceneNode=SceneManager->addMeshSceneNode(WaterMesh->getMesh(0),this);
WaterMesh->drop();
WaterMesh->drop(); causes program crash (so i hashed it out)

and:
VideoDriver->setClipPlane(0,refractionClipPlane,true);
produces error saying that there is no such method :( (so i hashed it out too)

i`m using 1.3.1SkinnedMesh branch and openGL
please help me - i would like to use this beatiful water
h4ck d4 5y5t3m
G3LO
Posts: 16
Joined: Mon Aug 20, 2007 10:37 am
Location: Poland

Post by G3LO »

I noticed that error i wrote about earlier is caused by float notation eg. 0.5f, i changed it to 0.5 but now i got:
0:62 `-` wrong operand types no peration `-` exists that takes a left-hand operand od type `const int` and rigth operand of type float (or there is no acceptable conversion)
0:62 `*` wrong operand types (yada yada yada)
0:64 `=`: syntax error parse error

i`m really stucked now :x please help
h4ck d4 5y5t3m
socialenemy
Posts: 3
Joined: Fri Sep 21, 2007 8:36 pm

Access Violation in IUnkown.h?

Post by socialenemy »

Alright, so the node looks Fantastic... I love it, but whenever i add it to the scene, i get a access violation in the device->drop() now. Without the node, no violation... Im pretty sure this type of violation means its looking up a pointer that is already deleted, but i can findout where the problem is. Anyone had similar issues and know how to fix it??

Implementation in main.cpp

Code: Select all

	
	RealisticWaterSceneNode* Water=new RealisticWaterSceneNode(smgr, 10.0f, 10.0f, 
		driver->getTexture("../data/waterbump.png"), device->getTimer());


alterations in RealisticWaterSceneNode.cpp

Code: Select all

scene::IAnimatedMesh* WaterMesh=SceneManager->addHillPlaneMesh("water",Size,core::dimension2d<s32>(10,10));
	
WaterSceneNode=SceneManager->addWaterSurfaceSceneNode(WaterMesh->getMesh(0),1,200,10);
	
	WaterMesh->drop();


Error Breakpoint

Code: Select all

		bool drop()
		{
			_IRR_DEBUG_BREAK_IF(ReferenceCounter <= 0) // someone is doing bad reference counting.

			--ReferenceCounter;
			if (!ReferenceCounter)
			{
				delete this; // <-- Heres the violation
				return true;
			}

			return false;
		}
socialenemy
Posts: 3
Joined: Fri Sep 21, 2007 8:36 pm

Quick Addendum

Post by socialenemy »

And quick side note:

If i hash out " // WaterMesh->drop(); " - No access violation, but the D3D9 Debug Spits out:

Code: Select all

Direct3D9: (ERROR) :Memory still allocated!  Alloc count = 136
Direct3D9: (ERROR) :Current Process (pid) = 00001644
Direct3D9: (ERROR) :Memory Address: 00336004 lAllocID=1 dwSize=000047f8, ReturnAddr=014134c8 (pid=00001644)
Direct3D9: (ERROR) :Memory Address: 0033c81c lAllocID=9 dwSize=000018e4, ReturnAddr=0140c2cb (pid=00001644)

...

Direct3D9: (ERROR) :Memory Address: 016235a4 lAllocID=30 dwSize=00001020, ReturnAddr=014134c8 (pid=00001644)
Direct3D9: (ERROR) :Total Memory Unfreed From Current Process = 54580 bytes
The program '[5700] aquascape.exe: Native' has exited with code 0 (0x0).
koller202
Posts: 143
Joined: Tue May 08, 2007 4:53 am
Location: Thailand

Post by koller202 »

i have ploblem same socialenemy

good for 1 map
but bug crashing in change map or level
________
NEW JERSEY MEDICAL MARIJUANA DISPENSARIES
Last edited by koller202 on Thu Feb 17, 2011 1:17 am, edited 1 time in total.
socialenemy
Posts: 3
Joined: Fri Sep 21, 2007 8:36 pm

Post by socialenemy »

Do you get the error just while changing levels or whenever you close down a scene with the RWSceneNode in it?
neil
Posts: 12
Joined: Fri Sep 28, 2007 1:04 am

Post by neil »

someone should adapt the current water surface node to have reflection and refraction qualities
koller202
Posts: 143
Joined: Tue May 08, 2007 4:53 am
Location: Thailand

Post by koller202 »

while change level and next level use real waterscenenode to

if next level didn t use waterscenenode my game no error
________
Cannabis seeds
Last edited by koller202 on Thu Feb 17, 2011 1:17 am, edited 1 time in total.
Post Reply