This article was written during the development of the project. The updated version is available here. At this link you can download the final paper, download the demo/source code, watch the latest videos and read the summary of the paper.
[WATCH VIDEO (stormy ocean) - NEW!]
[WATCH VIDEO (long ride) - NEW!]
[WATCH VIDEO (rainy ocean) - NEW!]
[WATCH VIDEO 1]
[WATCH VIDEO 2]
This is a short preview of my msc project, as it is still in development.
It is a DirectX11 application, using shader model 5.
At the moment it has wave animation using Fourier transform and Perlin noise (can switch between modes), ocean foam based on height/choppiness, hull shader tessellation and some water colouring. More features are to be added soon.
Some more details about the implementation:
- the scene consists of a list of trees of objects, each tree corresponding to a rendering shader. There is a main drawing pass, which loops through this list, and renders the leafs of the trees. All the other passes are managed using the command pattern: i.e. the additional passes for reflections and refractions are 2 concrete commands that are executed before the main rendering.
-the update loop: the trees are updated before each rendering loop. Note that this update doesn't mean an fft is computed before each frame for updating the ocean waves. The fft computations are placed on separate threads (each fft on a separate thread - one for heights, 2 for x/z displacements, optionally 2 for height derrivatives with respect to x and z and other 2 for displacements derrivatives). The water update call just copies the data from the threads shared memory to the textures that will represent the heightmap/displacement maps.
- the parameters are grouped in perScene, perObject and per Frame and sent in constant buffers to shaders.
- the HUD updates config items in the Application class. After each modification, the scene is reloaded from those config items. In some cases, shader macro definitions are changed, in which case the shaders are recompiled. The HUD is implemented using the State pattern, as there are several menus: Fourier menu, Perlin menu, Tessellation menu, Water colouring menu etc.
-the main Water class stores the current rendering mode (wave animation, normals computation mode), and updates the textures accordingly. The Fourier class has to manage all the fft threads (in some rendering modes, not all threads are working, so they are placed in a pause state, waiting for a wake-up event.)