120 likes | 254 Views
Real-time rendering of water and bubbles. William Moss Advanced Rendering Course Project December 4 th , 2008. Desired Effects. Water Local reflections Refraction External Lighting Fresnel Effect Bubbles Refraction External Lighting ( specular highlight). Water Effects.
E N D
Real-time rendering of water and bubbles William Moss Advanced Rendering Course Project December 4th, 2008
Desired Effects • Water • Local reflections • Refraction • External Lighting • Fresnel Effect • Bubbles • Refraction • External Lighting (specular highlight)
Local Reflection • Model water surface as a mirror • Reflect the scene over the rest water height • Clip • Render to a texture
Refraction • Model water surface as a plane • Clip everything below water surface • Scale along vertical direction by 1/1.33 • Render to a texture
Texture to Surface • Find screen position of undisplaced water surface position • Offset by the normal scaled by surface displacement • Lookup in the texture • tex2D(textureMap, screenPos.xy – displacement * normal.xz);
External Lighting • Simple Phong model for specular highlights • Assume light is coming from infinitely far away (as in the sun)
Fresnel Effect • Probability a photon is reflected or transmitted • Dependent on the incident angle • Formula is expensive, implemented as a 1D texture lookup
Refraction • Model bubble as one sided hemisphere • Refract the ray from the eye • Calculate the intersection with the ground plane • Lookup in a texture
External Lighting • Simple Phong model for specular highlights • Assume light is coming from infinitely far away (as in the sun)
Results Runs at ~30-40fps on my laptop Shaders written in NVidia Cg