330 likes | 456 Vues
Dive into the intricate world of water rendering in game development, exploring techniques that create realistic reflections and refractions for lakes and oceans. This guide covers essential concepts, from bump mapping and terrain rendering to advanced techniques such as cube maps. We break down the differences between lake and ocean rendering, highlighting the importance of factors like wave generation and normal mapping to simulate realistic water surfaces. With practical examples and recommended readings, this resource aims to elevate your understanding of water effects in real-time rendering.
E N D
Breakdown • Background • Review – terrain and bump mapping • What is water rendering? • Water Rendering • Reflection • Refraction • Techniques • Lakes, Oceans • Displacement
Recommended Reading • Real-Time Rendering doesn’t have anything specific • Review reflection, refraction, cube maps
Review – Terrain Rendering • Terrain rendering is the process of rendering realistic world surfaces • Can be real-world or alien world • The goal of terrain rendering is to provide an outdoor environment for your game • Even cityscapes can have underlying terrain • Terrain rendering generally focuses on the development of hills, valleys, mountains, etc. • These can be procedurally generated
Bump Mapping • Bump mapping is the technique used to add detail to a surface • Think roughness / texture • Bump mapping is the simplest technique for adding detail using textures
What is Water Rendering? • Water rendering is actually a collection of techniques that allow us to render realistic-ish water like effects • Remember in games we want real-time performance • Depending on the type of water, you need to adopt a different technique to provide a realistic effect • Generally fall into two categories for normal water • Lake and ocean
Advanced Examples • Bioshock • http://www.youtube.com/watch?v=t-utU84zp-Q • From Dust • http://www.youtube.com/watch?v=gSOQGazo7Oo
Lake Rendering • Lake rendering is for small bodies of water • No large waves usually involved
Ocean Rendering • Ocean rendering is for larger bodies of water • Waves are the required for ocean rendering
Cube Maps • Cube (or environment) maps are a form of texture used for reflection techniques • Cube maps are a lookup technique we use to determine the colour of a reflective pixel
Sky Dome • Sky domes or sky boxes are one of the techniques that utilise cube maps • Render the cube with the cube map • Move the cube with the camera • One of the standard effects in a 3D game
Core Concepts • Two core concepts are required when dealing with water • Reflection • Refraction • We have been talking about these ideas from a lighting point of view already • Light reflection • Light absortion
Reflection • Reflection from the water means we have to render on the water plane what we would see from a different angle • A sees the view from B on the pane • This involves a two stage view process
Reflection Map • Our reflection view render provides us with a reflection map texture we can use on our water • We just use this as a normal post-processing stage
Refraction • Refraction is the view we see under the water • What is under the water is defined by the height of the water plane • We use clipping to create a further texture from the viewers viewpoint for what is under the water
Refraction Map • The refraction stage creates another texture we can use in a post-process • The refraction map is blended with the reflection map to create the final water pixel colours
Fresnel Term • Finally, we blend the two textures together using a blend weight that depends on the viewing angle • Fresnel Term • The greater the angle made by the eye position to the normal, the more reflection to use
Final Colour • The final colour of a pixel on the water plane is determined by the blend of the reflection and refraction textures • On the right, ripples have been added by using a normal map
Lake Water • Lake water is the commonest water type seen in games • Much cheaper to produce • Only need two triangles • Normal maps take care of the rippling effect • Combining reflection, refraction, and a normal map will provide you with a generally realistic effect of water
Ripples • Ripples can be added to water using a normal map • Normal map just changes the normals at particular points • Blending normal maps, and moving texture coordinates will create a fairly realistic rippling effect
Ocean Water • Ocean water may be required for larger bodies of water • Big difference with ocean water is the number and size of the waves • We can use the standard two triangle and normal map approach • Looks ok • Usually want a triangle grid and deform the positions to look like water • Think terrain
Wave Deforming • To create wave effects, we just need to displace the heights of the individual vertices on the triangle grid • How we do this depends on the effect we want • Random • Use of blended heightmaps
Specular Reflections • We can add further lighting effects by using specular lighting on the water plane • Really, we just use the same technique as standard specular lighting
Wave Crests • For ocean water, we normally have wave crests • White at the top of waves • Can be height based, or steepness based
Particle Water • Also possible to use particle effects to create other water types • Fountains, waterfalls • This can be extended into volumetric rendering • Talk to Lukasz
To do this week… • Practical this week is on texturing • I need to tweak the one on WebCT a little • I know 3rd years have MAD CW due this week • Get it out of the way so you can move onto this one • I won’t be producing a practical on water effects • If interested, investigate yourself
Summary • Realistic water rendering is quite a common feature in modern games • Key components are reflection and refraction • Number of other techniques can be used on top of this • Normal maps • Displacement • Particle effects also an option