Realistic water node

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
The_Glitch
Competition winner
Posts: 523
Joined: Tue Jan 15, 2013 6:36 pm

Realistic water 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 render to texture effect and I believe that is the problem as both are trying to render to texture and causing conflicts.
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Realistic water node

Post by Vectrotek »

I'm watching this..
The_Glitch
Competition winner
Posts: 523
Joined: Tue Jan 15, 2013 6:36 pm

Re: Realistic water node

Post by The_Glitch »

No need to watch. While I've been away I looked into paraboloid reflections and made a shader for it and set it up in irrlicht it's seems pretty decent it's not as accurate as a cubemap but it only takes two passes as cubemapping takes up to six. And since I made it, it works fine in my application. I'll upload some screenshots of it. It's just like the video below minus the shadows as I did not need this.

https://youtu.be/xoTMdEoMlhQ
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Realistic water node

Post by Vectrotek »

Looks good! Bit advanced for me right now :?
The_Glitch
Competition winner
Posts: 523
Joined: Tue Jan 15, 2013 6:36 pm

Re: Realistic water node

Post by The_Glitch »

Image
Image

You can make the water more transparent by adjusting your materials alpha channel. I'm going to try to improve the water normal mapping effect as I feel it can be better.
Take 2 passes you can angle the two cameras for this effect in any direction you want. I mostly have the pass camera pointing up to capture everything right above the water.
I haven't added refraction yet.

Not as accurate as a cubemap but I've noticed it very performance friendly ;)
elvman
Posts: 253
Joined: Sun Sep 17, 2006 9:37 am
Location: Riga, Latvia
Contact:

Re: Realistic water node

Post by elvman »

Are you talking about my water scene node (https://github.com/elvman/RealisticWaterSceneNode)? If so, feel free to fork it, make your changes and send a pull request afterwards :).
Ouzel – 2D game engine
Realistic water node
The_Glitch
Competition winner
Posts: 523
Joined: Tue Jan 15, 2013 6:36 pm

Re: Realistic water node

Post by The_Glitch »

No elvman this water is using dual paraboloid reflection shaders. I created this as I could not get your water scene node to work with my main app that is using screen effects.
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Realistic water node

Post by mongoose7 »

elvman wrote:Are you talking about my water scene node (https://github.com/elvman/RealisticWaterSceneNode)? If so, feel free to fork it, make your changes and send a pull request afterwards :).
The problem is at Line 174:

Code: Select all

        //set back old render target
        _videoDriver->setRenderTarget(0, false, true);
You need to allow the render-target/framebuffer to be passed in.
elvman
Posts: 253
Joined: Sun Sep 17, 2006 9:37 am
Location: Riga, Latvia
Contact:

Re: Realistic water node

Post by elvman »

What do you mean by that? I am setting back the previous render target (setRenderTarget(0)) after rendering the water, so to render the water to your render target, just set it before rendering the water node.
Ouzel – 2D game engine
Realistic water node
The_Glitch
Competition winner
Posts: 523
Joined: Tue Jan 15, 2013 6:36 pm

Re: Realistic water node

Post by The_Glitch »

I think I tried that the water plane was always black. But if you rendered the scene with screen effect the water worked fine. Maybe what mongoose7 said??
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Realistic water node

Post by mongoose7 »

elvman wrote:What do you mean by that? I am setting back the previous render target (setRenderTarget(0)) after rendering the water, so to render the water to your render target, just set it before rendering the water node.
No, you are setting the framebuffer as the render target. There is no such thing as "the previous render target", the render target must be specified explicitly.
elvman
Posts: 253
Joined: Sun Sep 17, 2006 9:37 am
Location: Riga, Latvia
Contact:

Re: Realistic water node

Post by elvman »

Oh, ok, line 602 of IVideoDriver.h (driver->setRenderTarget(0); // set previous render target) and line 3781 of COpenGLDriver.cpp (COpenGLTexture* renderTargetTexture = static_cast<COpenGLTexture*>(prevRenderTarget->getTexture());) really got me confused. But there is no way to get current render target, so there is no way to reset back the previous render target in the OnAnimate method.
Ouzel – 2D game engine
Realistic water node
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Realistic water node

Post by mongoose7 »

But you can store it. Either RealisticWater(..., rtt=0) or water->setRTT(rtt). Then you can do driver->setRenderTarget(rtt ...);
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Realistic water node

Post by Vectrotek »

elvman.. You sir, are a Genius!! Your water node compiles with Irrlicht 1.8.3 and the blue GL artifact (GLSL mode) is solved by referring to textures using S32 instead of f32!
I'm really enjoying dissecting your project! Also the Screenquad based FXAA is the ultimate in Antialiassing! (I even turned off my Hardware AA)
I am learning at a geometric rate! I love the way you incorporated NVIDIA shader library shaders into the project!
This is really inspiring stuff! Are you a quantum physicist?
Wow... :idea: :idea: :idea: :D
elvman
Posts: 253
Joined: Sun Sep 17, 2006 9:37 am
Location: Riga, Latvia
Contact:

Re: Realistic water node

Post by elvman »

Ha ha, thanks! What do you mean by "referring to textures using S32 instead of f32"?
Ouzel – 2D game engine
Realistic water node
Post Reply