View Full Version : 3D tiling

06-29-2010, 09:35 PM
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?

06-29-2010, 10:24 PM
Behold ye moving mountains (erm... waves):

pic (http://img24.imageshack.us/img24/6980/bla3y.png)


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.

06-30-2010, 09:01 AM
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 ?

06-30-2010, 10:41 AM
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.

06-30-2010, 10:55 AM
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?

pic (http://img231.imageshack.us/img231/8816/bla4.png)

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.

07-01-2010, 09:14 AM
Searching for "fresnel reflection refraction opengl" gave me this page :

07-01-2010, 11:37 AM
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.

07-02-2010, 01:46 AM
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 ...

07-03-2010, 10:26 AM
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?