CSE 5542 - Real Time Rendering. TBT (Not So) Real Time Rendering.
Real-time rendering of water and bubbles
description
Transcript of Real-time rendering of water and bubbles
WILLIAM MOSS
A DVA N C E D R EN D E R I N G C O U R S E P R O J E C TD EC E M B E R 4 T H , 2 0 0 8
Real-time rendering of water and bubbles
Desired Effects
Water Local reflections Refraction External Lighting Fresnel Effect
Bubbles Refraction External Lighting (specular highlight)
Water Effects
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
Bubble Effects
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 laptopShaders written in NVidia Cg