Realistic water scene node

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

Postby Seven » Tue Apr 12, 2011 8:33 pm

elvman wrote:You haven't added any other objects to scene. What do you expect for water to look like if it has nothing to reflect and it has nothing under the surface?


and of course it worked perfectly once I added other items. Thanks for the scenenode, it really looks nice!
Seven
 
Posts: 594
Joined: Mon Nov 14, 2005 2:03 pm

Postby elvman » Tue Apr 12, 2011 9:34 pm

Seven wrote:and of course it worked perfectly once I added other items. Thanks for the scenenode, it really looks nice!

I am really glad to hear that.
elvman
 
Posts: 228
Joined: Sun Sep 17, 2006 9:37 am

Postby Dennis » Tue Apr 19, 2011 8:10 am

This does not work with multiple cameras.
I have a FPS camera and a static camera view from from the top (like a map view) in a small area in the top right corner.
This works perfectly in OpenGL.

However when I add a RealisticWaterSceneNode to the scene the top camera fills the screen and my map on/off shortcut just lets me switch between those two cameras. I am no longer able to show both views at the same time.

Any ideas?
Dennis
 
Posts: 3
Joined: Tue Apr 19, 2011 7:44 am

Postby Dennis » Tue Apr 19, 2011 9:59 am

There seems to be another problem.

If I have a scene with just a skydome and water and look straight ahead, everything looks fine. If i start to lower my camera angle, I would expect to see more and more blue water. This happens but the water turns darker and darker as the angle gets lower and lower.

Adding more and more objects to the scene helps but the error is still there it's just not that much visible anymore.
The scene uses ambient lighting.
Dennis
 
Posts: 3
Joined: Tue Apr 19, 2011 7:44 am

Postby elvman » Sat Apr 23, 2011 9:23 pm

Minor update: removed timer parameter from constructor.
http://www.gamedev.lv/files/RealisticWaterSceneNode020.zip

Now working on multiple view bug fix. Thanks for submissions.
elvman
 
Posts: 228
Joined: Sun Sep 17, 2006 9:37 am

Postby soulless » Mon Apr 25, 2011 2:52 am

Is there something more to edit in the code than just taking away the timer parameter from RealisticWaterSceneNode creation???

in version 19 I used to have:
Code: Select all
myRiverNode = new RealisticWaterSceneNode(smgr, 10000, 10000,
      driver->getTexture("media/textures/water.jpg"), device->getTimer());
...


with this new version, just took away the timer parameter:
Code: Select all
myRiverNode = new RealisticWaterSceneNode(smgr, 10000, 10000,
      driver->getTexture("media/textures/water.jpg"));
...


Now the water doesn't show.

And another question, I remember the demo that came with this shader (and thanks for the shader) using Irrlicht 1.4 or 1.5 and it got that crystal clear water, with version 19 I cannot get it, reflection works great, but the water is not transparent, it looks like liquid metal or something like that, here I show it:

Image

And the same with water node's visible set to false, so bottom distance can be apreciated:

Image

Thanks!!!
soulless
 
Posts: 24
Joined: Mon Jan 11, 2010 6:06 am

Postby elvman » Mon Apr 25, 2011 2:26 pm

Can you post a screenshot with camera looking at water (about 90 degrees)?
elvman
 
Posts: 228
Joined: Sun Sep 17, 2006 9:37 am

Postby soulless » Mon Apr 25, 2011 3:41 pm

If my configuration is important, my netbook:
Intel Core 2 Duo
GeForce 8600M GT

Code: Select all
device = createDevice(EDT_OPENGL, //driver
                    screenres,//screen resolution
                    32, //BPP
                    false, //fullscreen
                    true, //stencil shadows
                    false, // vsync
                    0); //event receiver


Image

Image

Thanks for your time.
soulless
 
Posts: 24
Joined: Mon Jan 11, 2010 6:06 am

Postby elvman » Mon Apr 25, 2011 5:11 pm

Ok, it seems that there are problems with the shader. Do you get any irrlicht warning generated by shader? And can you post some code (where you create the water scene node) and what objects do you have on scene?
elvman
 
Posts: 228
Joined: Sun Sep 17, 2006 9:37 am

Postby ACE247 » Mon Apr 25, 2011 7:57 pm

I just saw this new release and quickly tried it.
However using just the basics, terrain, skydome and water (simplest possible).
The water simply doesn't show, but the bumpMap is loaded. Same problem with D3D and OGL, but gl says unsupported texture format three times.

I guess the shader is buggered, but I'll have to leave that to someone else here since I should be busy elsewhere right now.
H8L6L5M4G3H5M7N8S7N9O1R8J1P5M7N9O4P2Q5R6T7U4M3N8X6S5T8W (If you want the secret, why not 'TRY' decrypting it? )
This Door's lock doesn't need a key, the Lock is the key to open the Lock and you don't know how to turn the key...
Link: My Blog :)
User avatar
ACE247
 
Posts: 695
Joined: Tue Mar 16, 2010 12:31 am
Location: Namibia

Postby soulless » Mon Apr 25, 2011 8:11 pm

No warnings about shader, water creation code:

Code: Select all
myRiverNode = new RealisticWaterSceneNode(smgr, 10000, 10000,
      driver->getTexture("media/textures/water.jpg"), device->getTimer());
      
      if(myRiverNode)
      {
         myRiverNode->setWindForce(10.5f);
         myRiverNode->setPosition(vector3df(15000.0f,80.0f,0.0f));
         myRiverNode->setMaterialFlag(EMF_LIGHTING, false);
         myRiverNode->setMaterialType(EMT_TRANSPARENT_ADD_COLOR);
         myRiverNode->setMaterialFlag(EMF_FOG_ENABLE, false);
      }


Before water creation I have 3 nodes:
2 IAnimatedMeshSceneNode (character .X, and weapon .OBJ) with shadowvolume and lighting on, fog off.

1 ITerrainSceneNode with lighting on, fog off.

After water creation:
1 skydome node:
Code: Select all
driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, false);
scene::ISceneNode* skydome=smgr->addSkyDomeSceneNode(driver->getTexture("media/textures/skydome.jpg"),16,8,0.95f,2.0f);
driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, true);


1 light:
Code: Select all
smgr->addLightSceneNode(0, vector3df(0, 15000, 2000),SColorf(0.1, 1, 1), 20000.0f, -1);


1 camera node:
Code: Select all
cam = smgr->addCameraSceneNode(0, vector3df(1800, 3800, -700), vector3df(0,3000,2000));
      cam->setNearValue(1.0f);
      cam->setFarValue(1000000.0f);
      cam->setPosition(vector3df(0,2000,-1500));



In the game loop just manage eventReceiver to control character position or exit, change character position and animation frame loop, change camera position relatively to character position.

Render with:
Code: Select all
driver->beginScene(true, true, SColor(255, 100, 100, 100));
smgr->drawAll();
driver->endScene();


Versions:
irrlicht 1.7.1 Professional (Build 7600)
RealisticWater 019
OpenGL 3.3.0
GLSL 3.3
IDE Visual Studio 2008 (C++)

PD: Under DIRECT3D9 the shader doesn't compile:
Code: Select all
HLSL pixel shader compilation failed:
(68): error X4523: cannot map this dependent texture read to ps_1_1
(63): error X4523: cannot map this dependent texture read to ps_1_1

HLSL vertex shader compilation failed:
(1): error X3000: syntax error: unexpected token 'vec2'


And Thanks again for your time, :)
soulless
 
Posts: 24
Joined: Mon Jan 11, 2010 6:06 am

Hi ~ I have a question

Postby tlsdudtj » Wed Apr 27, 2011 9:02 am

Surface water ~ On Object~

but... Camera position move... It is stange render .

What is the problem?...
http://blog.naver.com/sin1004s/70107777776
Good~
tlsdudtj
 
Posts: 1
Joined: Wed Apr 27, 2011 2:10 am

Postby elvman » Thu Apr 28, 2011 5:11 pm

Can you change the line 36 of realistic vater scene node (EVST_VS_1_1) to use VS version 2.0 and do the same for PS (line 37)?
I guess there is a problem with vertex and pixel shader versions.

HLSL vertex shader compilation failed:
(1): error X3000: syntax error: unexpected token 'vec2'

This error is strange. There are no vec2's in HLSL shaders.
elvman
 
Posts: 228
Joined: Sun Sep 17, 2006 9:37 am

Postby soulless » Fri Apr 29, 2011 3:22 am

Changing those lines change nothing visualy, I proved with every combination of EVST_VS and EPST_PS versions.

I was taking a look to the shader example that comes with Irrlicht (because I remembered about that example having a transparent cube), and I added EMT_TRANSPARENT_ADD_COLOR to addHighLevelShaderMaterialFromFiles function, with that I get a transparent water, but it is too transparent :D

This is the change in code (RealisticWater.cpp line 35):

Code: Select all
_shaderMaterial = GPUProgrammingServices->addHighLevelShaderMaterialFromFiles(
      waterVertexShader.c_str(), "main", video::EVST_VS_1_1,
      waterPixelShader.c_str(), "main", video::EPST_PS_1_1,
      this);


To
Code: Select all
_shaderMaterial = GPUProgrammingServices->addHighLevelShaderMaterialFromFiles(
      waterVertexShader.c_str(), "main", video::EVST_VS_1_1,
      waterPixelShader.c_str(), "main", video::EPST_PS_1_1,
      this,video::EMT_TRANSPARENT_ADD_COLOR);


And this is how it looks now:

Image

The only problem I see is that is too transparent and it doesn't look good (from my point of view) when I try to simulate the night, or maybe it must looks that way, just I don't know it (I haven't see to much water on night time), maybe when I add more objects around it will look better, anyway I'm very very happy with the results that the RealisticWaterSceneNode gives.

This is how it looks:

Image

Thanks again for taking your time to help!!!
soulless
 
Posts: 24
Joined: Mon Jan 11, 2010 6:06 am

Postby elvman » Fri Apr 29, 2011 2:41 pm

You made water transparent by using its alpha value. That is not the result wanted. I will try to search for other problems.
elvman
 
Posts: 228
Joined: Sun Sep 17, 2006 9:37 am

PreviousNext

Return to Project Announcements

Who is online

Users browsing this forum: No registered users and 1 guest