Bump mapping - Water little ripples

Started by
3 comments, last by ZQJ 18 years, 10 months ago
Hi, I'm working on rendering an ocean scene. I'm having trouble understanding how can I use bump mapping to make the water little ripples. I already have a height map. Can I use it to generate the ripples? Thanks. Leonardo
Advertisement
[Off the top of my head]

You could have an animation bump map series where you tick through each one using it as a bump map for the ripples.

ace

[/Off the top of my head]
Ok. But what about the resolution difference between the heightmap and the normal map?
paper

Maybe not what you were looking for, and i haven't read it so i don't know if it answer your question. But you could give it a try though.


Well, on the subject of that paper, I'm sure it's possible (and I'd venture not even that hard) to simulate the evolution of arbitrary wave patterns in the pixel shader. The differential equation governing the evolution of waves is pretty simple, you just need a good way of numerically integrating and differentiating in the shader.

The equation in question is:

1/c^2 (d^2 h/dt^2) = d^2 h/dx^2 + d^2 h/dy^2

Sorry it looks bad but typing complex formulae into simple text boxes is not easy. c is the speed of waves in the medium, h is the displacement. The point is you can work out the right hand side using numerical methods to estimate the derivatives. Then, by using the left hand side, along with some information about the position at previous times you can evolve the heightmap by a small time step. (i.e. you're going to need at least 3 heightmaps - one to hold current state, one to hold previous state, and one to hold newly calculated state). Since the shader given by that paper seems to simulate 4 sine and 4 cosine waves (okay I haven't read it that thoroughly...) this could be about as fast. I'd guess it'll involve approximately 6 texture reads per pixel. The rest by my reckoning can probably be done in two dot products and one addition, I'm not quite sure.

This topic is closed to new replies.

Advertisement