Ocean Rendering

From ActiveWiki
Jump to: navigation, search
Ocean Rendering




Ocean Shader Rendering


Ocean rendering includes several techniques. One of the most noticeable is reflecting the environment. Others are fresnel distortions for wavelets, and per pixel alpha for shallow water.

The ocean surface covers virtually the entire world. Smart level of detail (LOD) calculations only have it render as much as it actually needs to cover the current view range.

When changing into another world sector, that is every 100 cells or 1000 meters in each direction, the water surface is also rebuilt, along with terrain, considering the current world sector offset.

The terrain level at a point is used to determine the water depth and also the transparency, the per pixel alpha value, for this point.

Compatibility to the old water

It is important, if a world wants to support older graphic cards and other rendering modes than DirectX still, to keep the texture entries for Top Texture and for Top Texture Mask at least. This is the fallback rendering methods for all scenarios when DirectX shaders can not be used.

The shader techniques used is supported by DirectX capable cards since 2001.

In case you run DirectX, but still can not see new ocean water surface, update your graphic card's driver.

Intel Graphic chips often do not have the 3D capable drivers installed, click [1] for the official Intel driver search.

Ocean Shader Options

These settings are only used, if Enable Shader Ocean is check marked, otherwise the old water rendering is used.


The Color given with the old water settings, only affects the underwater fog color. To adjust the Surface Color, use the according setting under Ocean Shader Options.

Underwater tint allows you to adjust the tint color of the water. This goes along with the fog color, and can be used for a more detailed settings. E.g. it makes a nice effect if the tint color is choosen slightly darker than than the fog color.

Reflection Highlights adjusts the intensity of the bright reflections. E.g. to reduce the brightness of the sun reflecting on the water surface, reduce reflection highlights to a value lower than 1.0.


The Grid settings adjusts the resolution of the water surface. A value of 1.0 creates a grid of 10 meters by 10 meters, the same size grid of the underlaying terrain. Yet, if the wave height is low, it does not make much sense to use a high density grid. For flat water surface, the grid could be much bigger, up to 5 times the grid size for terrain.

The grid size affects the amount of render and pre-calculation load directly. A low grid size can have a noticeable impact on overall performance, in particular on mid-end and low-end computers.

Shallow Water

Shallow Water is the region when water depth gets below a certain range. The minimum water depth before it starts rendering shallow areas can be set with the Depth parameter.

Intensity determines how bright the shallow water texture should be blended with the ocean surface texture. The range is from 1.0 for fully rendered, to 0.0 for not rendered at all.

Scale determines the texture scaling applied onto shallow region. A good value to start is 8.0, but it can go up to 32.0 maximum.

Distortion determines how intense the wavelet's distortion should be blended with the shallow texture, it changes the texture coordinates for the shallow texture dynamically.


Two kinds of wave forms can be adjusted.

Wavlets are a fresnel-bump-technique blended as texture onto the ocean surface, including the reflection map.

Geometric Waves are animating the ocean surface and its vertices. Only if these are used, a lower grid size makes sense (see above). There are 4 simultaneous geometric waveforms available, each can be set from another direction, speed and height, resulting in overlaying pattern.

All waveforms allow to adjust Height, Speed and Direction. Height is given in meters, speed is a relative value and the direction is currently given in radians in a range from -PI to +PI.


The height and speed of the old water settings are master controls for the geometric waveform's details. E.g. if the height of Wave 1 is set to 2.0 meters, and the master control is set to 0.5, the resulting height will be 1.0 meter.

Hardware Requirement Details

The HAL (Hardware Abstraction Layer) must support at least:

  • Vertex Shaders version 1.1
  • Pixel Shaders version 1.4
  • 5 simultaneous textures
  • Cubemap texture as render target (for reflection maps)
  • V8U8 texture format (for bump maps)
  • 32bit ARGB texture formats
  • 24bit RGB and greyscale texture formats
  • Index buffer 32bit or 16bit(build 1309 and later)

Graphic cards that cannot describe these minimum features in their hardware layer, won't be capable rendering the new ocean water. This only affects a few cards, including some embedded Intel chipsets.

The most significant hardware capabilities are shown, starting with build 1309, in the aworld.log file.