Rendu
A lightweight rendering engine for experimentations
|
Realistic rendering of a sandy island in the ocean. More...
#include <IslandApp.hpp>
Classes | |
struct | GerstnerWave |
Public Member Functions | |
IslandApp (RenderingConfig &config, Window &window) | |
void | draw () override |
void | update () override |
void | resize () override |
~IslandApp () override | |
![]() | |
CameraApp (RenderingConfig &config, Window &window) | |
virtual void | update () override |
virtual void | physics (double fullTime, double frameTime) |
![]() | |
Application (RenderingConfig &config, Window &window) | |
virtual void | draw ()=0 |
virtual void | update () |
virtual void | finish () |
virtual void | resize ()=0 |
double | timeElapsed () |
double | frameTime () |
double | frameRate () |
Window & | window () |
virtual | ~Application () |
Application (const Application &)=delete | |
Application & | operator= (const Application &)=delete |
Application (Application &&)=delete | |
Application & | operator= (Application &&)=delete |
Private Member Functions | |
void | generateWaves () |
Private Attributes | |
Texture | _sceneColor |
Scene lighting. | |
Texture | _scenePosition |
Scene positions. | |
Texture | _sceneDepth |
Scene depth. | |
Texture | _waterEffectsHalf |
Underwater terrain with caustics. | |
Texture | _waterPos |
Underwater terrain world positions. | |
Texture | _waterEffectsBlur |
Blurred underwater terrain. | |
Texture | _environment |
Environment cubemap. | |
BoxBlur | _blur = BoxBlur(true, "Water") |
Underwater terrain blurring. | |
std::unique_ptr< Terrain > | _terrain |
Terrain generator and rendering data. | |
const Mesh * | _skyMesh |
Sky supporting mesh. | |
Mesh | _oceanMesh |
Ocean grid mesh. | |
Mesh | _farOceanMesh |
Far ocean supporting cylinder mesh. | |
const Texture * | _caustics |
Caustics texture. | |
const Texture * | _waveNormals |
Small waves normal map. | |
const Texture * | _foam |
Foam texture. | |
const Texture * | _brdfLUT |
Linearized GGX BRDF look-up table. | |
const Texture * | _sandMapSteep |
Normal map for steep dunes. | |
const Texture * | _sandMapFlat |
Normal map for flat regions. | |
const Texture * | _precomputedScattering |
Precomputed lookup table for atmospheric scattering. | |
const Texture * | _absorbScatterOcean |
Precomputed lookup table for ocean absoprtion/scattering. | |
Texture | _surfaceNoise |
Sand surface normal noise. | |
Texture | _glitterNoise |
Specular sand noise. | |
Program * | _groundProgram |
Terrain shader. | |
Program * | _oceanProgram |
Ocean shader. | |
Program * | _farOceanProgram |
Distant ocean simplified shader. | |
Program * | _waterCopy |
Apply underwater terrain effects (caustics). | |
Program * | _underwaterProgram |
Underwater rendering. | |
Program * | _skyProgram |
Atmospheric scattering shader. | |
Program * | _tonemap |
Tonemapping shader. | |
glm::vec3 | _lightDirection |
Sun light direction. | |
float | _lightElevation = 6.0f |
Sun angular elevation. | |
float | _lightAzimuth = 43.0f |
Sun horizontal orientation. | |
bool | _shouldUpdateSky = true |
Should the environment map be updated at this frame. | |
UniformBuffer< GerstnerWave > | _waves |
Waves parameters. | |
const int | _gridOceanRes = 64 |
Ocean grid resolution. | |
float | _maxLevelX = 1.0f |
Maximum level of detail. | |
float | _maxLevelY = 1.0f |
Maximum subdivision amount. | |
float | _distanceScale = 1.0f |
Extra distance scaling. | |
bool | _showTerrain = true |
Should the terrain be displayed. | |
bool | _showOcean = true |
Should the ocean be displayed. | |
bool | _showSky = true |
Should the sky be displayed. | |
bool | _stopTime = false |
Pause ocean animation. | |
bool | _showWire = false |
Show debug wireframe. | |
Additional Inherited Members | |
![]() | |
void | freezeCamera (bool shouldFreeze) |
![]() | |
ControllableCamera | _userCamera |
The interactive camera. | |
![]() | |
RenderingConfig & | _config |
The current configuration. | |
std::unique_ptr< DebugViewer > | _debug |
Debug viewer. | |
Realistic rendering of a sandy island in the ocean.
The terrain is rendered as a integer-shifted vertex grid as described by M. McGuire in his post "Fast Terrain Rendering with Continuous Detail on a Modern GPU", 2014 (http://casual-effects.blogspot.com/2014/04/fast-terrain-rendering-with-continuous.html). High-frequency sand shading is based on the "Sand Rendering in Journey" presentation, J. Edwards, GDC 2013 (https://www.youtube.com/watch?v=wt2yYnBRD3U).
Ocean is tesselated on the fly based on the distance to the camera and displaced using Gerstner waves as described in "Effective Water Simulation from Physical Models", M. Finch, GPU Gems 2007 (https://developer.nvidia.com/gpugems/gpugems/part-i-natural-effects/chapter-1-effective-water-simulation-physical-models). Caustics, scattering and absorption effects are based on the Hitman "From Shore to Horizon: Creating a Practical Tessellation Based Solution" presentation, N. Longchamps, GDC 2017 (https://www.gdcvault.com/play/1024591/From-Shore-to-) Additional foam effects are inspired by the "Multi-resolution Ocean Rendering in Crest Ocean System" presentation, H. Bowles, Siggraph 2019 (http://advances.realtimerendering.com/s2019/index.htm).
Inherits CameraApp.
IslandApp::IslandApp | ( | RenderingConfig & | config, |
Window & | window | ||
) |
Constructor
config | rendering config |
window | the window to render to |
|
override |
Destructor.
|
overridevirtual |
Draw call.
Implements Application.
|
private |
Generate waves with random parameters in predefined ranges.
|
overridevirtual |
Handle a window resize event, the configuration has been updated with the new size.
Implements Application.
|
overridevirtual |
Per-frame update.
Reimplemented from CameraApp.