-
Notifications
You must be signed in to change notification settings - Fork 218
Ocean simulation
When the option called Shader Effects is set to at least high or r_water
is set to 1
, ocean simulation is enabled. This simulation is made of two phases:
- Heightmap Calculation
- Rendering
This phase computes the height of each point of the ocean. To compute this, we have to solve the wave equation. This is done by synthesising all possible standing waves by using 2D Fourier transform.
We didn't choose Euler method to solve the wave equation because of the following reasons:
- This method is progressive and computation error is accumulated, resulting in
- Unconserved kinematic energy.
- Divergence.
- This method is apt to cause high-frequency noise.
- Mathematical instability.
The OpenGL renderer provides four levels of ocean render quality settings. They are chosen by r_water
config variable.
In this setting, it doesn't render the ocean in a special way and treats it as if it's a part of the terrain.
This setting simulates the following properties of the ocean water:
- Color (something like fog in an atmosphere)
- Fresnel Reflection
- Refraction
Currently, only the sky color is considered in simulating reflection.
Refraction is approximated (not physically accurate at all). It only shifts rendered pixels of objects in the water.
This setting simulates reflection using a popular approximate method.
This setting is the most advanced setting in OpenSpades, or perhaps in most if not all modern games. It combines the traditional "portal" mirror rendering technique and screen-space raytracing to render physically-accurate reflection and refraction.
This wiki is in the middle of an update process to match the latest changes of OpenSpades 0.1.2
It may contain outdated, incorrect or incomplete information.
Please contact the repository owner (@yvt) via email or ask a question in the issue tracker if there is any obscure information you are looking for that can't be found in neither the source code nor in this wiki.