|
[In this new Intel-sponsored feature from the Visual Computing microsite, a trio of Intel engineers showcase an experiment to create an ocean and complex fog effects using Direct3D 10 and Shader Model 4.0, complete with freely available source code and executable demo.]
Introduction
The purpose of this project was to investigate how we
could effectively render a realistic ocean scene on differing graphics
solutions while trying to provide a current working class set of data to the
graphics community.
Given the complexities involved with rendering an ocean
as well as fog effects we chose to start by using a projected grid concept,
because of its realistic qualities, as our baseline.
We then ported the original Direct3D 9 code to
Direct3D 10 and also ported the additional effects we needed to convert to
Shader Model 4.0. In doing so we took advantage of a great opportunity to learn
about an interesting subject (the projected grid) while adding many more
nuances to it.
In addition to determining how best to work with this
complex system under a DirectX10
scenario, we also wanted to know what would be required to achieve reasonable
frame rates on both low- and high-cost graphics solutions.
During this
endeavor we learned much about how to offload certain computations to the CPU
versus the GPU, as well as when and where those compute cycles would be the
most beneficial, both on high-end and low-end graphics solutions. For example,
on the CPU front, using the Intel Compiler (version 10.1), we were able to
gain an easy 10+ fps on our CPU-side computations (to generate fog and
approximate wave movement).
Projected Grid Ocean
The basic concept behind the projected grid ocean is a
regular discretized xz-plane that is displayed orthogonally to the viewer in world
space. The vertices of this grid are then displaced using a height field. The
height field is a product of two variables, which return the height value as
specified by the following equation:
This method has proven very useful for generating a
virtual large body of water.
The Perlin noise computation for generating the wave
motion uses four textures of varying granularity called "octaves" to animate
the grid in three dimensions. We chose this method to generate wave noise over
other functions, such as Navier-Stokes, because it was less compute intensive
on the CPU. The GPU-side Navier-Stokes implementation was not used, but it is
worth further investigation. For reflections and refractions the algorithm uses
derivations of Snell's function.
To further add realism to the scene we restricted the
height of the camera on the y axis so that the illusion of ocean vastness could
be maintained.
For a detailed description of this method, refer to Claes
Johanson's Master Thesis.1
---
1
Johanson, Claes. "Real-time
water rendering-introducing the projected grid concept." Master of Science
thesis in computer graphics, March 2004.
http://graphics.cs.lth.se/theses/projects/projgrid/, http://graphics.cs.lth.se/theses/projects/projgrid/projgrid-hq.pdf
(PDF)
|