Ocean1 example
This example is based on the paper "Real-time Realistic Ocean Lighting using Seamless Transitions from Geometry to BRDF", Eric Bruneton, Fabrice Neyret and Nicolas Holzschuch, Eurographics 2010, and on the associated source code (basic version). It also uses the atmosphere model of the "atmo" example, which must be run at least once before running this example (in order to generate the precomputed atmospheric textures).
The "HelloWorld.cpp" is taken from the "Edit1" example. The ocean shader and the proland::DrawOceanTask are based on the source code provided with the above paper, with two improvements: support for spherical oceans, and improved management of the horizon (see sec-oceans).
In the scene graph description, the method to draw the ocean must be declared like this:
<sequence name="drawOceanMethod"> <setProgram> <module name="globalsShader"/> <module name="atmosphereShader"/> <module name="this.material"/> </setProgram> <drawOcean radius="6360005.0" zmin="20000.0" brdfShader="oceanShader"/> </sequence>
This indicates that we want to use a spherical ocean (with a radius of 6360005), which must be drawn when the altitude of the camera is less than 20000. We must also specify the shader that contains the uniforms related to ocean lighting.
The ocean scene node is then very simple:
<node name="ocean" flags="object"> <bounds xmin="-6370000" xmax="6370000" ymin="-6370000" ymax="6370000" zmin="-6370000" zmax="6370000"/> <method id="draw" value="drawOceanMethod"/> <module id="material" value="oceanShader"/> </node>
Ocean2 example
This example is based on the paper "Real-time Realistic Ocean Lighting using Seamless Transitions from Geometry to BRDF", Eric Bruneton, Fabrice Neyret and Nicolas Holzschuch, Eurographics 2010, and on the associated source code (improved version). It also uses the atmosphere model of the "atmo" example, which must be run at least once before running this example (in order to generate the precomputed atmospheric textures).
The "HelloWorld.cpp" is taken from the "Edit1" example. The ocean shader and the proland::DrawOceanFFTTask are based on the source code provided with the above paper, with two improvements: support for spherical oceans, and improved management of the horizon (see sec-oceans).
In the scene graph description, the method to draw the ocean must be declared like this:
<sequence name="drawOceanFFTMethod"> <setProgram> <module name="globalsShader"/> <module name="atmosphereShader"/> <module name="this.material"/> </setProgram> <drawOceanFFT radius="6360005.0" zmin="20000.0" brdfShader="oceanFFTShader"/> </sequence>
This indicates that we want to use a spherical ocean (with a radius of 6360005), which must be drawn when the altitude of the camera is less than 20000. We must also specify the shader that contains the uniforms related to ocean lighting.
The ocean scene node is then very simple:
<node name="ocean" flags="object"> <bounds xmin="-6370000" xmax="6370000" ymin="-6370000" ymax="6370000" zmin="-6370000" zmax="6370000"/> <method id="draw" value="drawOceanFFTMethod"/> <module id="material" value="oceanFFTShader"/> </node>