Rendu
A lightweight rendering engine for experimentations
Loading...
Searching...
No Matches
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
IslandApp Class Referencefinal

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
 
- Public Member Functions inherited from CameraApp
 CameraApp (RenderingConfig &config, Window &window)
 
virtual void update () override
 
virtual void physics (double fullTime, double frameTime)
 
- Public Member Functions inherited from Application
 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 ()
 
Windowwindow ()
 
virtual ~Application ()
 
 Application (const Application &)=delete
 
Applicationoperator= (const Application &)=delete
 
 Application (Application &&)=delete
 
Applicationoperator= (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

- Protected Member Functions inherited from CameraApp
void freezeCamera (bool shouldFreeze)
 
- Protected Attributes inherited from CameraApp
ControllableCamera _userCamera
 The interactive camera.
 
- Protected Attributes inherited from Application
RenderingConfig_config
 The current configuration.
 
std::unique_ptr< DebugViewer_debug
 Debug viewer.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ IslandApp()

IslandApp::IslandApp ( RenderingConfig config,
Window window 
)

Constructor

Parameters
configrendering config
windowthe window to render to

◆ ~IslandApp()

IslandApp::~IslandApp ( )
override

Destructor.

Member Function Documentation

◆ draw()

void IslandApp::draw ( )
overridevirtual

Draw call.

Implements Application.

◆ generateWaves()

void IslandApp::generateWaves ( )
private

Generate waves with random parameters in predefined ranges.

◆ resize()

void IslandApp::resize ( )
overridevirtual

Handle a window resize event, the configuration has been updated with the new size.

Implements Application.

◆ update()

void IslandApp::update ( )
overridevirtual

Per-frame update.

Reimplemented from CameraApp.


The documentation for this class was generated from the following files: