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 »

Next problem..
So I have an object that is "Plane Clipped" (generally set) at the right times for
"Above" and "Below" water (Reflection & Refraction)..
Then I assign a "New Material (2TCoord based Shader)" to that object and..
NO MORE PLANE CLIPPING!
Whats going on? :cry:

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

Re: Realistic water node

Post by Vectrotek »

I really want to post a working project..
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Realistic water node

Post by Vectrotek »

All I need is the Clip Planes to work..

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

Re: Realistic water node

Post by Vectrotek »

Hacking at it piece by piece..
Image
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Realistic water node

Post by Vectrotek »

Plane Clipping now done in the shaders themselves.. (otherwise no shaders..)
Only problem is that every object that touches this water will need to have its shaders
injected with this function.. (not really difficult or large amount of code so its O.K.)
Plane Distance discarded and replaced with simple distance on Y Axis.
Image
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Realistic water node

Post by Vectrotek »

Water edges softened with "Fresnel + DepthEdges" (related to REFRACTION)..
Image
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Realistic water node

Post by Vectrotek »

Reflection image at edges softened with (1.0-Fresnel * Negative Edge Depth) related to REFLECTION MAP..
Image
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Realistic water node

Post by Vectrotek »

Normal Damping using Edge Values to gradually Flatten Normals as the fragment approaches hard edges..
This prevents reflecting at hard edges resulting in bogus reflections.
Image
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Realistic water node

Post by Vectrotek »

No Hard Visible Edges..

Image

No Depth Buffer Render! No ClipPlanes!

Still needs colour and a few extra tweaks but looks O.K. sofar?
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Realistic water node

Post by Vectrotek »

Why is "Clip Planes" disabled the moment your material is bound to a shader? (GLSL or HLSL)??
It can be solved but it has the implication that all your shaders have to have a little function inside them
that can puts that shader in a "Specific Mode", i.e. NORMAL RENDER, CLIP ABOVE, CLIP BELOW or RENDER-Y-DEPTH..
This is O.K. but then makes it so that you cannot call your Water Scene Node "Totally Independent" (which is really what we'd like)..
Is there somewhere inside Irrlicht where this Clipping Plane can be FORCED even if Materials have Shaders Hooked to them?
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Realistic water node

Post by Vectrotek »

Simply can't do without Plane Clipping..
Image
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Re: Realistic water node

Post by devsh »

its because its not enough that you simply enable the clip plane, you need to write to gl_ClipDistance in the GLSL shader
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Realistic water node

Post by Vectrotek »

Thanks.. Plane dropped for simpler Y axis..
Image
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Realistic water node

Post by Vectrotek »

Image
Every object shader touched by water gets Depth and Clipped Above Plane or Below..
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Realistic water node

Post by Vectrotek »

Image
Post Reply