Jump to content
  • Advertisement
Sign in to follow this  
five1mon

The best method to use for reflection on ocean waves

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

Hey

I'm looking for a method to render reflections in ocean waves. The scene in question contains several meter high waves near a coastal harbor. Different kinds of objects are floating in the water. So I want these dynamic objects as well as the surrounding static geometric to reflect in a convincing manner. The reflection is rather distorted by ripples so some degree of inaccuracy can be accepted. Does anybody know of a good method to use for this?

 

Atm a variant of planar reflection is used, which looks acceptable when the waves are small to medium sized but when they're getting larger all sorts of artifacts appears. The method can't be too expensive to compute either or I won't be able to use it.

 

 

Thanks :-)

Edited by five1mon

Share this post


Link to post
Share on other sites
Advertisement

Well if the surrounding geometry is static and the scene is large enough, you could build a cubemap or an envmap of it, and then sample it while doing reflection of your ocean waves and floating objects (and apply fresnel as needed) which would be a pretty good approximation I think. Not sure how expensive that would be, how often does the geometry around the water change?

Share this post


Link to post
Share on other sites

Well if the surrounding geometry is static and the scene is large enough, you could build a cubemap or an envmap of it, and then sample it while doing reflection of your ocean waves and floating objects (and apply fresnel as needed) which would be a pretty good approximation I think. Not sure how expensive that would be, how often does the geometry around the water change?

Wouldn't it look "wrong" where the objects intersects the water, such as floating buoys and boats. I read about some techniques doing parallax compensation to improve the quality of cube maps, not sure if that can be used here?

Share this post


Link to post
Share on other sites

 

Well if the surrounding geometry is static and the scene is large enough, you could build a cubemap or an envmap of it, and then sample it while doing reflection of your ocean waves and floating objects (and apply fresnel as needed) which would be a pretty good approximation I think. Not sure how expensive that would be, how often does the geometry around the water change?

Wouldn't it look "wrong" where the objects intersects the water, such as floating buoys and boats. I read about some techniques doing parallax compensation to improve the quality of cube maps, not sure if that can be used here?

 

 

Ah, sorry, I misread that you wanted the dynamic objects to reflect their surroundings, not the water reflecting the dynamic objects. Yes, it would look wrong. If the dynamic objects are small enough and not too many of them, perhaps an impostor based approach could work (by computing the cubemap and, for each frame, superimposing impostors of each dynamic object at the right angle, or some other method).

 

Any trick used is probably going to rely on details like how big the objects are relative to the rest of the scene or some other factor, though.

Share this post


Link to post
Share on other sites

 

 

Well if the surrounding geometry is static and the scene is large enough, you could build a cubemap or an envmap of it, and then sample it while doing reflection of your ocean waves and floating objects (and apply fresnel as needed) which would be a pretty good approximation I think. Not sure how expensive that would be, how often does the geometry around the water change?

Wouldn't it look "wrong" where the objects intersects the water, such as floating buoys and boats. I read about some techniques doing parallax compensation to improve the quality of cube maps, not sure if that can be used here?

 

 

Ah, sorry, I misread that you wanted the dynamic objects to reflect their surroundings, not the water reflecting the dynamic objects. Yes, it would look wrong. If the dynamic objects are small enough and not too many of them, perhaps an impostor based approach could work (by computing the cubemap and, for each frame, superimposing impostors of each dynamic object at the right angle, or some other method).

 

Any trick used is probably going to rely on details like how big the objects are relative to the rest of the scene or some other factor, though.

 

 

Actually, I think he did mean that the water should reflect the dynamic objects. The problem with a pre-baked cubemap is that it doesn't really achieve the "mirror" effect that he's after; most obviously the dynamic objects won't move in the reflection, and equally importantly, since a cubemap takes into account the angle of reflection but not the position from which the reflection ray originates, the reflections won't be in the correct spot.

 

EDIT: What I'm describing below is probably what the OP meant by "planar reflections" so it probably doesn't add anything new, so feel free to skip to the next edit

 

The most straightforward approach is to use a dynamic cubemap calculated underwater and directly below the player at the same distance from the water as the player (i.e. the cubemap's position is the player's position reflected over the water). That way, the angle from the cubemap will match the player's viewing angle when reflected by the water (this may not be totally intuitive, but if you draw the rays on paper it becomes very obvious).

 

Obviously in order to be completely accurate, this approach assumes that the water is a perfectly flat surface; the nice thing is that it still looks very good on mostly flat surfaces (which water typically is) for the same reason that any kind of environment map typically looks good even if it's not calculated from exactly the right place.

 

EDIT: If the above method yields too many artefacts as you say, I suggest potentially using an additional cube map, this one being calculated at precisely at the player's location. You can switch to or interpolate with this map as the water's normal vector gets farther from the planar vector. These reflections won't be accurate (in terms of position), but the artefacts will likely be less distracting, since you are at least guaranteed that the second cube map won't contain anything that the player can't see directly.

Edited by cowsarenotevil

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!