Jump to content
  • Advertisement
Sign in to follow this  
jfdegbo

Water reflection edges artefacts (GLSL)

This topic is 4439 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

[EDIT : here is a video of the (temporary?) solution used, XViD codec.] Hello, i'm working on a water system, very HL2-like. in fact i use a 3 pass method 1- reflected scene (clipped) - clear frame and depth buffer 2- refracted scene (clipped) with volumetric fog 3- the water plane (using the refeflect and refract textures) & the upper world (clipped, again). The water is rendered using a normal map, and the vectors of this normal map are used to offset the texel reading in the to other maps. My problem is very common, but I didn't find information about how devs handle it. As you can see there are gasps at the edges. Image Hosted by ImageShack.us I think a lot about it and founded some solutions, some of them are not realistic in terms of perf. Others are introducing other errors. 1 - Calculate the Y value on a per fragment basis of the bump mapped water and clip per fragment the reflected scene (heavy cost) 2 - Offset the clipping plane by the maximum height of a wave in the water texture (in fact simulated height, as it is a plane), to try avoiding "to run out of reflect to show" (a few more reflect is drawn than necessary to fill the gasps. the second method works quite well to remove those artefact, but make some new ones a different stages. Indeed, the reflects are sometimes visible where it should not. Image Hosted by ImageShack.us To exaplain, i drawed a blue line where the cube intersect the water plane. No reflects of the cube should be seen above that line... this is unfortunately the case, and it is fairly logical... that is because i shifted the clipping plane of the reflected scene. Sorry for the legnth of the post. I would really apreciate help, or knowledge on how does devs handle this problem. Thanks in advance. [Edited by - jfdegbo on July 22, 2006 9:22:14 AM]

Share this post


Link to post
Share on other sites
Advertisement
Actually, Half-Life 2 has the same problem.
http://techreport.com/etc/2004q3/source-engine/5950-noreflect.jpg
It can't be solved because of the nature of the method you use.

Share this post


Link to post
Share on other sites
Well, I'm not sure of what I see in this screenshot, anyway, i didn't remember seeing a lot of artefact in the source engine on the "edges of the water".

But I noticed in their engine that the deformation is mostly X axis driven... Don't know exactly why.

No one ever did this water effect and got rid of those gasps ?

Thx

JFD

Share this post


Link to post
Share on other sites
Maybe it helps, if you place your clipping plane for rendering your reflection map a slight bit upwards

Share this post


Link to post
Share on other sites
yes Hydrael,

that is what I did, but there comes the second screenshot...
It's strange not to have more feedback, I think every one who wants to do water reflections (without cube map) falls onto the same problems.

Share this post


Link to post
Share on other sites
Oh, sorry jfdegbo - I've only read the first half of your first post, because I once had the same problem (regarding the artifacts).
Regarding the succeeding problem I can't help you, because I haven't had any situations within my engine yet, that would make such "wrong reflections" appear.

I guess you did try to play around with the clipping plane's offset a bit? Maybe there there is a value, that "minimizes" both problems.

Share this post


Link to post
Share on other sites
The problem is just logically unsolvable.
You're trying to access a position in the texture that doesn't exist, so it just wraps around.
Look more attentively at the screenshot I've posted.
You will notice the brown artefacts at the edges, just like in your screenshot.
Valve did two things to minimize the visibility of the artefacts in Source.
First of all, they use smaller waves. It obviously makes the gaps smaller.
They also make the color of the gaps close to the color of the ground to make it less noticeable.
If you doubt, run HL2 and play the 'd1_canals' maps.
It's extremely noticeable there.

Share this post


Link to post
Share on other sites
Hydrael : No problem, i'm pleased that you respond !
in fact, this would apear when you place your eyes near that plane ... very close to the surface... like when swimming with the head out of the water

mrbig : In fact no, there's no wrap, i think you misunderstood the problem. It comes from the fact that once cut, the geometry of the clipped reflections does have "holes" that is uncapped intersection with the clipping plane, i you see what I mean.

Share this post


Link to post
Share on other sites
Please excuse me for my ignorance, but no, I don't see what you mean.
Whether it wraps or not doesn't matter.
You're trying to draw something that doesn't exist, but it has to draw something, so that's what it does.
http://img91.imageshack.us/img91/6788/omggy2.jpg
The red line in the picture above is the refracted reflection of the shoreline, which I have marked green.
You see, the shoreline's reflection is over there, any further than that and it just draws the void inside your shore!
There's nothing there and there can't be, so it probably fills it with the clear color you set.

Share this post


Link to post
Share on other sites
I know, and I don't exclude changing of technique in any of the stages... but I have no clue to do it in another way in real time. That's why I'm asking commets / suggestions.

Thanks for your response anyway mrbig.

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!