Sign in to follow this  

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

This topic is 1107 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:

post-224872-0-16979200-1417613526_thumb.

Result OK

Dynamic Case:

post-224872-0-39334900-1417613563_thumb.

Cracks happen!!!

 

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

Thanks!

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

This topic is 1107 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this