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!
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Realistic water node

Post by Vectrotek »

Image
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Realistic water node

Post by Vectrotek »

Image
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Realistic water node

Post by Vectrotek »

Image
The_Glitch
Competition winner
Posts: 523
Joined: Tue Jan 15, 2013 6:36 pm

Re: Realistic water node

Post by The_Glitch »

https://youtu.be/bjzmA5lJ5Mk

I've improved the reflection shader and added flow maps for the water to get better results for things that are actually in the water. I have not added refraction yet but once I do it should be a pretty good alternative for water rendering.
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Realistic water node

Post by Vectrotek »

I like the "flow" effect!
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Realistic water node

Post by Vectrotek »

I finally managed to get a "Custom Three Layer Cloud Node" (tbw) reflected on a simple "Water Reflection Node" (elvman)..
Image
The code is a mess, so I'll post it when it looks better..
The_Glitch
Competition winner
Posts: 523
Joined: Tue Jan 15, 2013 6:36 pm

Re: Realistic water node

Post by The_Glitch »

Vectrotek I added Refraction to my water node I'll post some screenshots later.
The_Glitch
Competition winner
Posts: 523
Joined: Tue Jan 15, 2013 6:36 pm

Re: Realistic water node

Post by The_Glitch »

Pics

Image
Image
Image

Pictures are hard to see so I posted a video link.
Last edited by The_Glitch on Fri Jul 15, 2016 7:26 pm, edited 1 time in total.
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Re: Realistic water node

Post by devsh »

For the love of god use clamp() on your refracted screen space coordinates, cause otherwise you'll refract from the other side of the screen at the edges... also grab the depth map and clamp against that so you dont refract from the stuff in front of the water
The_Glitch
Competition winner
Posts: 523
Joined: Tue Jan 15, 2013 6:36 pm

Re: Realistic water node

Post by The_Glitch »

Materials are using ETC_CLAMP. I'll look in to it some more. Just got it up and running before I posted.
The_Glitch
Competition winner
Posts: 523
Joined: Tue Jan 15, 2013 6:36 pm

Re: Realistic water node

Post by The_Glitch »

Found my mistake I set the array for the materials to be clamped after I set the materials.

Here's the new pictures:

Image
Image
Image
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Realistic water node

Post by Vectrotek »

If I use "createDeviceEX()" with HLSL/D3D and then rendering to a Render Target the Z Buffer has problems..
It also causes Occlusion Queries in Render Targets to malfunction.
(I hope its not my machine)

Here is Lensflare, 3 layers of Moving Clouds,
Water Reflection / Refraction (clamped properly),
FXAA Antialiassing and Posterization.
Image
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Realistic water node

Post by Vectrotek »

I think its possible to include the "Edge Wave Dampening" functionality offered by the extra "Depth Buffer" Render
WITHOUT that Depth Buffer Render using "Distance From Plane" where the plane would be parallel to
the water. If it works then EVERYTHING can be done in the water shader without the need
to render the depth and all those complex calculations seen in tbw's XML based PostProc.
My version is based on Elvman's Water Node but will have lots of extra functionality.
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Realistic water node

Post by Vectrotek »

Image


Reflecting Lens Flare has a few problems.
The math involved makes it so that it can't be
reflected like everything else and the "Sprites"
or "Images" of the "Flares" will not be "Plane Clipped"
(used in water rendering) so I had to add a
function to the Water Renderer called
"ExcludeItems(ISceneNode* Node);" which
then sets this lens flare node to invisible
from within the water renderer itself. It worked.

Somehow the Billboard used for the sun itself
survived the "setVisible(false);" from the water
renderer so it reflects just fine.
Everything happens in a very specific order.

Also, when I disabled the cube map I had
to re-code all the Post Processor and Water Renderer
calls to setRenderTarget() to include the basis Background Colour.
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Realistic water node

Post by Vectrotek »

I have a working formula for determining on which side of a plane a point is.
My question is: "Is it possible to emulate " PrivateVideoDriver->setClipPlane(0, refractionClipPlane, true);"
in a shader (GLSL or HLSL)" using such a formula?
Post Reply