Boat reflections and wakes

I’m stuck at my parents’ house, after driving two hours only to find the road to my place flooded, so I thought it’d be a good time to think about a problem that’s stumped me for a bit.

I’m rendering an ocean that isn’t planar. Right now it’s just a summation of Gerstner waves, but I plan to add some FFT vertex displacement in the future.

Since I’m not using a plane, it seems that my reflection options for local objects (boats) are limited or non-existant.

More importantly, drawing wakes seems difficult as well. The ocean isn’t tesselated uniformly, so even rendering triangles per-wake using the same Gerstner wave equations in the ocean vertex shader leads to the ocean sticking through the wake where the tesselation is sufficiently different. Something tells me I should be dealing with screenspace vertices here to begin with, but I’m too tired at the moment.

I can draw wakes using projected textures during the same fragment shader that renders the ocean, but it seems that I’ll run into the looping constraints of GLSL, i.e. no addressing into arrays based on a uniform variable, only compile time variables. I haven’t looked into vendor-specific extensions, but a recent GLSL thread indicated that no current card can use a uniform as an address/array index.

Wakes aren’t well-represented by a single texture, so I think my best option is to render many wake passes into a texture from an overhead orthographic projection, and then use the render texture in the ocean shader. I’ll just have to use a different shader for each number of boats that are visible in the scene, which is fortunately a small number for my application.

Any advice is welcome.

My (untested) thoughts on this.

Do you really need accurate reflections on highly deforming ocean geometry, there’s the simple fact that the further your ocean surface deviates from a plane, the less likely you are to notice reflection weaknesses. So you could try simply rendering it as if the surface is flat, and then either fading out or adding some noise depending on slope. For wakes, there’s not much I could recommend, except, your wakes and ocean geometry could both benefit from clipmapping or some form of LOD, even if it’s purely for anti-aliasing purposes.

On all the demos i have seen from the guys at Nvidia and so on, most reflections are done as if the water surface was perfectly flat, then they distorted that using some kind of refraction shader, and it looks good enough to pass as belevable.

With larger oceanic waves you typicly don’t see that many reflections and you could use a low res cube map for that.

Can anybody post the opengl program for 3d boat & waves?

Why did you ask this in a thread from five years ago? Is there something wrong with the “New Thread” button?

Also, your post seems to be missing necessary details. Which “3d boat & waves” program are you looking for? I’m fairly sure that there are many such programs, so we need you to narrow it down a bit.

I am creating a screen saver using opengl function. In that, I need to have a boat which is sailing in the water. This is what my requirement. Can anybody post the program for this ? If so, pls do post it.

If you want to create such a screen saver why you need an existing program that does it already? Do you want to create or copy? :slight_smile: