How to make a wavey sheet?

Started by
3 comments, last by VizOne 15 years, 8 months ago
I have created a plane in xz, and created a wave in 3D: Points[index].y = (float)(rand()%32768)/32768.0f; So now I have a wavy sheet but its static in time. I would like to change it in time with some random effect so that its perhaps not periodic. How can I do that?
Advertisement
I just used cosf() and sinf(), and I maked it as a function of x (space) and angle or time.
Try looking into perlin noise. It is repetitive, but only after a while. 2D perlin noise will give you a static heightmap. Use 3D perlin noise to animate the heightmap (the first two dimensions are the position, and the other one is the time).

If you really want to, you could even use 4D or 5D perlin noise to remove some of the repetitiveness.

The nice thing with perlin noise is that it will generate a nice smooth mesh while animating because it is continuous. You will not have any points appearing out of nowhere, they will grow slowly.
I have made some noise but I dont know if its perlin noise?
	for(int i = 0; i < height; i++)	{		for(int j = 0; j < width; j++)		{			pNoise[i*width+j] = (float)(rand()%32768) / 32768.0f;		}	}
Have a look at http://freespace.virgin.net/hugo.elias/models/m_perlin.htm
Andre Loker | Personal blog on .NET

This topic is closed to new replies.

Advertisement