This is the implementation of water using projected grid. It has both refraction and reflection. Also, it gives better detail up close and also has smooth and good water displacement. Noise textures are created and animated to create height map. It allows to simulate various water waves type: from near flat water to large waves ocean. Combine with atmospheric scattering and we have some nice ocean scene. The implementation is based on Claes Johnson's paper.
Some screenshots:
And here is it in action:
- For large view: follow this link
- Watch it here:
* Demo breakdown:
- Deferred shading is used to achieve better and faster rendering than forward rendering. Lighting calculation was done in camera space and optimized using stencil masking.
- Atmospheric scattering was computed based on pre-computed textures: transmittance, irradiance, and inscatter. It has multiple scattering for realistic color.
- Noise textures were created and animated over time. They then were used to create heightmap for the water grid. Heightmap then was used to generate normal map that can be lookup in the shader for water grid.
- Water grid was projected using a 2nd camera with some elevation from the original camera. The 2nd camera projection was built based on the main camera's frustum.
- Sun scattering color was blend with terrain texture to create realistic color with respect to sun position during the day.
- SSAO was added for more realism and give a sense of depth for the scene.
Updated Metaballs2 demo
5 years ago