Page 1 of 8

Realistic water node

Posted: Tue May 17, 2016 5:47 pm
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.

Re: Realistic water node

Posted: Sun May 22, 2016 4:34 pm
by Vectrotek
I'm watching this..

Re: Realistic water node

Posted: Mon May 23, 2016 12:58 am
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

Re: Realistic water node

Posted: Mon May 23, 2016 8:56 am
by Vectrotek
Looks good! Bit advanced for me right now :?

Re: Realistic water node

Posted: Mon May 23, 2016 9:32 pm
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 ;)

Re: Realistic water node

Posted: Tue May 24, 2016 10:07 am
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 :).

Re: Realistic water node

Posted: Tue May 24, 2016 12:09 pm
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.

Re: Realistic water node

Posted: Wed May 25, 2016 9:06 am
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.

Re: Realistic water node

Posted: Wed May 25, 2016 9:25 am
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.

Re: Realistic water node

Posted: Wed May 25, 2016 12:13 pm
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??

Re: Realistic water node

Posted: Wed May 25, 2016 1:03 pm
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.

Re: Realistic water node

Posted: Wed May 25, 2016 1:19 pm
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.

Re: Realistic water node

Posted: Wed May 25, 2016 11:16 pm
by mongoose7
But you can store it. Either RealisticWater(..., rtt=0) or water->setRTT(rtt). Then you can do driver->setRenderTarget(rtt ...);

Re: Realistic water node

Posted: Tue Jun 14, 2016 9:35 pm
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

Re: Realistic water node

Posted: Wed Jun 15, 2016 11:18 am
by elvman
Ha ha, thanks! What do you mean by "referring to textures using S32 instead of f32"?