Wayward
Environment Rendering Demo
By Chris Gibson and Lisa Hunter
Introduction
Wayward is a rendered environment that utilizes a variety of different shading techniques and graphic-rendering concepts. The scene is set on a remote cluster of small islands lost in the middle of the ocean, surrounded only by empty sea. The spinning orb surrounded by disks represents a way-marker, as if to help those lost at sea find their way home. The logs represent items from the main land that have become lost as well yet have ended up in this empty place, and the birds that occasionally fly over head mean that the main land is not far away. The multi-colored fireflies add more mystery to the small islands, and help inspire a feeling of hope.
Technologies
The following are technologies implemented in Wayward:
-
Height-Mapped Terrain: The terrain is rendered based on a grey-scale bitmap image. The height of each vertex of terrain is decided by the brightness the respective pixel on the bitmap; the more white the pixel is, the higher the terrain will be.
-
Reflective, Rippling Water: The water uses a shader that applies both a displacement map as well as mathematical sine formulas to generate the appropriate ripple 'offset' for the reflection image (generated in a previous pass.) The displacement maps and sin equations are modified using a theta value in order to give the appearance that the water is moving.
-
Bloom/Glow Effects: Bloom and glow effects involved a three pass post-processing system applied after the scene is rendered. First, the scene is rendered normally into an off-screen texture using a Frame Buffer Object (FBO.) The image is then contrasted using a simple shader and rendered into another off-screen buffer for Gaussian-blur post processing. Mip-map images are generated from the contrasted image to create four different levels of detail (512x512, 256x256, 128x128 and 64x64.) Each mip-map level is blurred using a 5 texel kernel and all added up with the initial untouched off-screen texture to create the final product. In order to increase the glow of objects, we simply increased the values of their ambient material past 1.0 values, allowing them to 'bleed' into the surrounding scene.
-
Terrain Detail Textures/Multitexturing: When glanced upon at a distance, the islands are painted with a low-resolution texture, but upon closer inspection, the texture changes to become more detailed. This effect is gained by mixing the regular and detail textures based on the camera's distance to each vertex. The closer the user got to the polygon, the more mixed in the detail textures became. The terrain models actually included four textures total, a regular and detail texture for both grass and sand.
-
Animated Hierarchical Models: There are 4 major hierarchical models in Wayward: logs, fireflies, birds, and an orb surrounded by rotating disks. Each model is completely textured and uses a simple light shader to calculate the Phong Model lighting per fragment.
Controls
[w] : Move forward
[s] : Move backward
[a] : Strafe left
[d] : Strafe right
Left-Click: Adjust the camera view (click and drag)
Screenshots
References
Bloom
S., Wright, Richard. OpenGL superbible comprehensive tutorial and reference. 4ty ed. Upper Saddle River, NJ: Addison-Wesley, 2007.
Reflections
S., Wright, Richard. OpenGL superbible comprehensive tutorial and reference. 4ty ed. Upper Saddle River, NJ: Addison-Wesley, 2007.
"Water reflections - GameDev.Net Discussion Forums." GameDev.net - all your game development needs. 4 June 2009 <http://www.gamedev.net/community/forums/topic.asp?topic_id=253039>.
"Water reflections with OpenGL." Pixel Infinity. 4 June 2009 <http://ivanleben.blogspot.com/2008/03/water-reflections-with-opengl.html>.
Shaders
"NeHe Productions: OpenGL Article #21." NeHe Productions: Main Page. 1 June 2009 <http://nehe.gamedev.net/data/articles/article.asp?article=21>.
"OpenGL Shading Language @ Lighthouse 3D - GLSL Tutorial." Lighthouse 3D: A Resource for 3D Programmers on OpenGL, VRML, and Shockwave 3D. 1 June 2009 <http://www.lighthouse3d.com/opengl/glsl/>.
S., Wright, Richard.
OpenGL superbible comprehensive tutorial and reference. 4ty ed. Upper Saddle River, NJ: Addison-Wesley, 2007.
"Tutorials." ClockworkCoders. 1 June 2009 <http://www.clockworkcoders.com/oglsl/tutorials.html>.
Height Mapping
"OpenGL @ Lighthouse 3D - Terrain Tutorial." Lighthouse 3D: A Resource for 3D Programmers on OpenGL, VRML, and Shockwave 3D. 4 June 2009 <http://www.lighthouse3d.com/opengl/terrain/index.php3?heightmap>.