Jump to content
  • Advertisement
Sign in to follow this  

Cracks occur while Rendering Water using Oblique Frustum Clipping to Gain the Reflection Map

This topic is 1414 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am learning rendering water using oblique frustum clipping to gain a Reflection Map.

If the water is static,the result will be OK.

But if the water is dynamic,cracks will happen!

I have been trying to use a little offset when blending the Reflection Map,but the result will not alleviate too much.

Static Case:


Result OK

Dynamic Case:


Cracks happen!!!


Dose anyone know how to solve it,Or should I use another way to gain the Reflection Map?


Share this post

Link to post
Share on other sites
There is no simple way to solve it, all games have that issue. You can improve the situation slightly by lowering the clipping plane to the lowest level a wave can reach, that way you'll avoid having gaps between geometry and reflection and in most cases the overlapping reflection is behind the object, thus the bug is hidden.

doesn't work well for the teapot handle and as waves are not only distorting up/down but also left/right, you'll still see issues on the silhouettes, but people are trained to ignore those glitches (as long as texture filtering uses 16taps ;) )

Share this post

Link to post
Share on other sites

There is no simple way to solve it


Which means there are ways, but most of them are too expensive for realtime rendering (and the results in difference are not worth the performance lose). To quickly describe one...


Rendering reflection works like -> you mirror your world using water plane, and clip the geometry using that plane (leaving only parts that are below) - this will work just fine ... but only when you're using plane of course.


One of the faster solutions to deal with that comes from idea - your water's pixel position can be described using displacement along water plane normal (which is right for almost every water renderer in games these days) - which allows you to calculate distance from camera to water surface on given pixel; Now, you render your reflection this way -> you mirror your world using water plane, calculate distance from the mirrored geometry to camera, and you calculate distace of "camera-to-water-surface", discarding any pixel that is in front of the water surface.


This way you remove the effect you're seeing on your images, but ... nothing is free.

  • There is overhead of calculating distance of "camera-to-water-surface"
  • As you're discarding pixels, you can't really use some kind of occlusion culling when rendering reflected part of scene
  • Discarding pixels is more expensive then clipping (if I remember correctly from head - clipping is done after vertex shader execution, so you should also use clip plane here, clipping anything that is above the maximum height reachable from the plane after displacement)

EDIT: Also it is important to think, whether implementing whole of the above is worth the trouble of removing small artefacts for water refraction. I'd say it also depends on how often will user see water in the end in the application - if 99% of gaming time there won't be any visible water, then it's not definitely worth it ... if 99% of gaming time you're seeing water surface, well... then I'd say you should try to make water look as good as possible.

Edited by Vilem Otte

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!