Realistic water scene node

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
Mars_999
Posts: 136
Joined: Sat Dec 08, 2012 7:59 pm

Re: Realistic water scene node

Post by Mars_999 »

Did you read my post? You need to adjust the clip plane
Christi258
Posts: 62
Joined: Wed Feb 06, 2013 12:11 pm

Re: Realistic water scene node

Post by Christi258 »

Ok, thanks.
But how do I do that?
elvman
Posts: 253
Joined: Sun Sep 17, 2006 9:37 am
Location: Riga, Latvia
Contact:

Re: Realistic water scene node

Post by elvman »

I will look into this. Thanks for feedback.
Ouzel – 2D game engine
Realistic water node
Mars_999
Posts: 136
Joined: Sat Dec 08, 2012 7:59 pm

Re: Realistic water scene node

Post by Mars_999 »

Code: Select all

 
void RealisticWaterSceneNode::OnAnimate(u32 timeMs)
{
    ISceneNode::OnAnimate(timeMs);
 
    _time = timeMs;
 
    //fixes glitches with incomplete refraction
    const f32 CLIP_PLANE_OFFSET_Y = 250.0f;//5.0f
 
    if (IsVisible)
    {
        setVisible(false); //hide the water
 
        //refraction
        _videoDriver->setRenderTarget(_refractionMap, true, true); //render to refraction
 
        //refraction clipping plane
        core::plane3d<f32> refractionClipPlane(0, RelativeTranslation.Y + CLIP_PLANE_OFFSET_Y, 0, 0, -1, 0); //refraction clip plane
        _videoDriver->setClipPlane(0, refractionClipPlane, true);
 
        _sceneManager->drawAll(); //draw the scene
 
        //reflection
        _videoDriver->setRenderTarget(_reflectionMap, true, true); //render to reflection
 
        //get current camera
        scene::ICameraSceneNode* currentCamera = _sceneManager->getActiveCamera();
 
        //set FOV anf far value from current camera
        _camera->setFarValue(currentCamera->getFarValue());
        _camera->setFOV(currentCamera->getFOV());
 
        core::vector3df position = currentCamera->getAbsolutePosition();
        position.Y = -position.Y + 2 * RelativeTranslation.Y; //position of the water
        _camera->setPosition(position);
 
        core::vector3df target = currentCamera->getTarget();
 
        //invert Y position of current camera
        target.Y = -target.Y + 2 * RelativeTranslation.Y;
        _camera->setTarget(target);
 
        //set the reflection camera
        _sceneManager->setActiveCamera(_camera);
 
        //reflection clipping plane
        core::plane3d<f32> reflectionClipPlane(0, RelativeTranslation.Y - CLIP_PLANE_OFFSET_Y, 0, 0, 1, 0);
        _videoDriver->setClipPlane(0, reflectionClipPlane, true);
 
        _sceneManager->drawAll(); //draw the scene
 
        //disable clip plane
        _videoDriver->enableClipPlane(0, false);
 
        //set back old render target
        _videoDriver->setRenderTarget(0, false, true);
 
        //set back the active camera
        _sceneManager->setActiveCamera(currentCamera);
 
        setVisible(true); //show it again
    }
}
 
Seven
Posts: 1034
Joined: Mon Nov 14, 2005 2:03 pm

Re: Realistic water scene node

Post by Seven »

where can i get waterNormal.png and waterDvDv.png file from?
pyandrea
Posts: 11
Joined: Sun Jul 13, 2014 7:01 pm

Hello (water)World

Post by pyandrea »

I hope not to be off-topic, but I realize that many people here are using elvman's Realistic Water (https://github.com/elvman/RealisticWaterSceneNode).
As a newbie, I am looking for a simple example ('Hello World style') using elvman's Realistic Water.
Please, can you suggest the corresponding source code?
elvman
Posts: 253
Joined: Sun Sep 17, 2006 9:37 am
Location: Riga, Latvia
Contact:

Re: Realistic water scene node

Post by elvman »

I uploaded a sample app, that runs on OSX. If it doesn't run on Windows, please let me know, I will try to fix it later.
http://elviss.lv/files/water_sample.zip
Image
Ouzel – 2D game engine
Realistic water node
diho
Posts: 46
Joined: Fri May 20, 2011 9:01 pm
Location: Netherlands

Re: Realistic water scene node

Post by diho »

What causes this:

Image

-Diho
chronologicaldot
Competition winner
Posts: 688
Joined: Mon Sep 10, 2012 8:51 am

Re: Realistic water scene node

Post by chronologicaldot »

diho wrote:What causes this:

Image

-Diho
Your image isn't appearing, but I found the redirect to the actual image for anyone interested:
http://postimg.org/image/xsvoezvqj/

I can't answer the question, though, sorry. Hard to say what's going on without knowing how you set things up.
diho
Posts: 46
Joined: Fri May 20, 2011 9:01 pm
Location: Netherlands

Re: Realistic water scene node

Post by diho »

The only code I use is:

Code: Select all

RealisticWaterSceneNode *water = new RealisticWaterSceneNode(smgr, 102400.0f, 102400.0f);
    smgr->getRootSceneNode()->addChild(water);
    water->setPosition(spawnPoint);
elvman
Posts: 253
Joined: Sun Sep 17, 2006 9:37 am
Location: Riga, Latvia
Contact:

Re: Realistic water scene node

Post by elvman »

Can you try the demo app that I uploaded?
Ouzel – 2D game engine
Realistic water node
The_Glitch
Competition winner
Posts: 523
Joined: Tue Jan 15, 2013 6:36 pm

Re: Realistic water scene node

Post by The_Glitch »

Has anyone gotten this to work with there main application that is using some rtt effects?

I've looked into changing some things but can't get it to render the water the plane is just black. I believe the waterscenenode does it's own render to texture method and my application does it's own which is the issue just not sure what to change in the waterscenenode as my attempts are not working.
kas1e
Posts: 212
Joined: Sun Jan 21, 2018 8:39 am

Re: Realistic water scene node

Post by kas1e »

@All
Can anyone explain, why there: https://github.com/elnormous/RealisticW ... r.cpp#L120

In the "RealisticWaterSceneNode::OnAnimate()" we do have 2 times _sceneManager->drawAll(); : one time after refraction, and another after reflection. This reduce FPS x2.

I mean, should't it be calcualted refraction, the refletion, and only then one single "drawall()" call ?
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Realistic water scene node

Post by CuteAlien »

Maybe because Irrlicht didn't have multi render targets when it was coded (wasn't in Irrlicht 1.8 I think).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
kas1e
Posts: 212
Joined: Sun Jan 21, 2018 8:39 am

Re: Realistic water scene node

Post by kas1e »

@CuteAlien
Maybe because Irrlicht didn't have multi render targets when it was coded (wasn't in Irrlicht 1.8 I think).
Strange.. I just comment out one single DrawAll() call (first one), and keep just second one, and do have instead of 14 FPS, 24 FPS, and everything working as before.

Did it mean that 1.8.4 do have multi-render targets ?
Post Reply