Semi-realistic Ocean

Started by
10 comments, last by joe1024 16 years ago
I'm trying to make a fairly realistic looking ocean without using too much processing power. There's a little video of what I'm doing at the moment here:
It's basically using a sine wave equation to generate the wave movement. I hit a smooth 60fps (fraps dropped the frame rate in the video) doing this over a fairly small area of water. I'm wondering has anyone got better suggestions on wave generation and are there any possible methods for creating waves over large areas of water? Thanks.
Advertisement
I'm sure you've heard of perlin noise. Generate textures that hold the perlin noise pattern. (make sure it's tileable perlin noise) and see if that gives what you want. Also I'm just guessing but if you put land points along the shoreline you can perform sine wave offset going towards shore on the water heightmap to get a simple shoreline effect.
Yeah I undestand the suggestion of perlin noise but I don't know how you can render such vast amounts of vertices. Here's an example of what I mean:
http://www.inrebellion.com/gamesprog/ocean.jpg
I'm relatively new to this. How do you do something like that?
Have you tried breaking the ocean into sub-meshes? If you break them up into smaller pieces you can then calculate a bounding box and test each box against the camera's view. If you get a "collision" then render it otherwise skip that sub-grid. I'm running into a similar problem. The other thought I had is to transform the smaller ocean out in front of the camera as opposed to rendering the entire "map".
Well at the moment my ocean only renders what's in the camera's view so unnecessary ocean doesn't get rendered. However if you look at the ocean screenshot from another person's project the amount of triangles that are being rendered and manipulated (moved up and down) is very high. I want to know how it's possible to render and manipulate that many?
post the code of how you render the ocean. I don't do 3D programming, but normally you batch the vertices when rendering. Just wanna make sure your not drawing the triangles individually like with some OpenGL GL_TRIANGLES or something. It's been a while since I've used any graphics APIs.
Quote:Original post by PeteD
However if you look at the ocean screenshot from another person's project the amount of triangles that are being rendered and manipulated (moved up and down) is very high. I want to know how it's possible to render and manipulate that many?

To manipulate those huge numbers of triangles it's best to do it using a vertex shader (on the GPU) rather than on the CPU.
There is an article in the Gamasutra about Deep-Water Animation and Rendering. Also there are some chapters in the GPU Gems series. You can take a look of them.
"A human being is a part of a whole, called by us,universe, a part limited in time and space. He experiences himself, his thoughts and feelings as something separated from the rest... a kind of optical delusion of his consciousness. This delusion is a kind of prison for us, restricting us to our personal desires and to affection for a few persons nearest to us. Our task must be to free ourselves from this prison by widening our circle of compassion to embrace all living creatures and the whole of nature in its beauty."A. Einstein
http://graphics.cs.lth.se/theses/projects/projgrid/ gives some nice results for rendering water with a high vertex count
Oliver Charles (aka aCiD2) [ Cycles Blog ]
One thing to consider is that you also don't have to actually render all the detail. You can use bumpmapping to add detail to the waves, without actually having to incrase the complexity. I don't think that Ogre screenshot is actually renderng all those small triangles for the waves (if you look, they are uniform like a flat plane along the ground), it looks more like it's animating the larger triangles per vertex (for actual depth in the scene), then applying a bumpmap to add the minute details.

This topic is closed to new replies.

Advertisement