Water Filter Graphical Glitches

Hey Guys,

First things first, here my water filter setup. Spatial is a Plane/Quad coming from blender

WaterFilter water = new WaterFilter(Main.self.getRootNode(), Vector3f.UNIT_Y.mult(-1f));
water.setWaterHeight(spatial.getLocalTranslation().dot(Vector3f.UNIT_Y) - 0.2f);
water.setUseFoam(false);
water.setUseRipples(true);

water.setWaterColor(ColorRGBA.Cyan);
water.setDeepWaterColor(ColorRGBA.Cyan);
   
water.setWaterTransparency(0.4f);
water.setMaxAmplitude(0.3f);
water.setWaveScale(0.012f);
water.setSpeed(0.6f);
water.setShoreHardness(1.0f);
water.setRefractionConstant(0.1f);
water.setShininess(0.3f);
water.setSunScale(1f);
water.setColorExtinction(new Vector3f(10.0f, 20.0f, 30.0f));
water.setUseHQShoreline(true);
water.setCenter(spatial.getLocalTranslation().subtract(0f, 0.4f, 0.4f   ));
water.setRadius(11f);
filters.add(water);


Here you see some small reflection of the character in the water. Not like the regular reflection but somehow the camera view added and distorted by the waves.
Wrong Bucket?


Probably a “don’t look at things from the side” error, but when slowly diving down into the water (right inbetween the “outside” and the underwater view), you see this, what seems to be a texture/view for the distortion of the waves?

Yes and yes.

The first one is actually the refraction. It’s supposed to display the bottom of the water distorted. We use the back buffer instead of re rendering the scene with a clipping. This avoid an additional geometry pass… but… if there is something in the foreground you can see it a bit distorted in the water.
Note that we do have an additional pass for reflection.
Many games use this trick and I feel pretty happy when I see the same artifact in AAA games.

the second is one is one of the major drawbacks of the technique, it looks like crap at steep angles.

So both are drawbacks of the Water Filter which aren’t really fixable?
I guess extending the Water Filter so that the waves react to the player walking and interfering with each other is really challenging?

And another question: For a correct Water Radius I’d have the following task:
Find a Circle C so that every vertex of the polygon lies in that circle.
d(M, V) <= r

The Circumscribed circle would be d(M, V) = r, so that doesn’t help.
Is there any genious mathematical solution other than calculating said distance and simply taking the biggest distance?

yes

yes

oh man…there is for sure. I’d google it if I had to do this.