3D tiling

I have a water tile (a heightfield), that I can render ok, but don’t know how to tile it. I was thinking of forcing the two pairs of edges of the tile to have the same height values, like this:

b  b
b  b

But the results are not convincing. Can you please share some insights?

Behold ye moving mountains (erm… waves):


Maybe I should attenuate the wave tiles at the edges? I could also flip odd tiles, but flopping odd tiles will make waves move the wrong way. Please help.

To be tileable, your pattern must have wave length which is an integer multiple of the pattern length, and for each direction.

How do you build your wave tile ?

Using the gerstner algorithm. If I do as you say the only 2 directions I will be able to use will be horizontal and vertical.

This one looks better doesn’t it? I did it by specifying:

h(0, z) = h(1, z) and
h(x, 0) = h(x, 1)

and fixing the wave parameters to comply.

Maybe you can discern some artifacts in the snapshot, something that I did wrong?


The only thing remaining now for me is to figure out how to do bump mapping, reflections and I’ll probably have what is called environmental bump mapping. I’ve noticed that many programs attenuate what they reflect. Do they simply multiply the reflected colors with a coefficient < 1? I’ll probably have to model the sun using a directed light no? Do I use Phong shading for water? I’ll be grateful for every hint you may have for me.

Searching for “fresnel reflection refraction opengl” gave me this page :

The problem is, I don’t have shaders available. The water is supposed to be rendered using fixed pipeline only. Does anyone have any hints about what to do in this case to make the waves look good? AFAIK, fresnel reflection is not supported by the fixed pipeline. Particularly, I’d like to know how to add foam to wave crests with the fixed pipeline.

Maybe with 1D texture, blue everywhere and white on the last texel, then assign texcoords on your waves to make the top appear white.
Not a lot of options for doing realistic water with fixed pipeline …

Good idea, the intrinsic color of waves would then have to be black, as the texture will already color them. I’m not certain a completely white top will cut it (would make wave look more like a snow-capped mountain probably). I could however generate 2D textures at wave-generation time using the same algorithm I would otherwise use in a shader. Basic reflections could then be rendered with multi-texturing. The fixed pipeline also supports bump mapping, so this way I could get bump mapping + reflections. On top of that, I’d put some Phong lighting. Are these ideas sound?