1 / 8

Just add

Just add. Water. Early Attempt. Per-Vertex sinusoidal warping of position Per-Vertex sinusoidal warping of normal All Lighting Per-Vertex VS/PS 1. Next Attempt. Still VS/PS1 Per-Vertex creation of “Tangent-Space” Basis Scrolling Normal-Map coordinates (scrolled in VS)

saddam
Download Presentation

Just add

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Just add Water

  2. Early Attempt • Per-Vertex sinusoidal warping of position • Per-Vertex sinusoidal warping of normal • All Lighting Per-Vertex • VS/PS 1

  3. Next Attempt • Still VS/PS1 • Per-Vertex creation of “Tangent-Space” Basis • Scrolling Normal-Map coordinates (scrolled in VS) • Normal-Map sampled in PS, then put in world-space and reflected to sample Environment Map • This is possible with the magic PS instructionstexm3x3pad t1, t0_bx2texm3x3pad t2, t0_bx2texm3x3vspec t3, t0_bx2 • This performs a 3x3 matrix multiply, reflection, and cube-map lookup; AMAZING! • This is impossible to do without dropping into the assembly-style shader programming

  4. Next Attempt (cont.) • Additionally, some per-vertex light color computation (Gouraud-style) • Also added “reflection-map”, perturbed in VS and sampled in PS using a second pass • This required rendering the reflected scene to a dynamic texture, and implementing per-pixel clipping using the instruction “tex-kill” (simulated user-clip planes) • This texture is the “reflection-map”, which is then projectively-textured onto the water geometry

  5. 3rd Time’s the Charm • VS/PS 2 (ahh… more than 8 instructions in the pixel shader! Yay!) • No more sin/cos stuff • 4 scrolling bump maps, scrolled in different directions and speeds • Reflection Map (render to texture, 1st pass) • Refraction Map (render to texture, 2nd pass) • “Real” User Clip Planes • When using Fixed-Function Pipeline, user clip planes are expected to be in World Space • When using Programmable Pipeline, user clip planes are expected to be in Clip Space… go figure! Good ol’ DirectX

  6. 3rd Time’s the Charm (cont.) • Render everything for real, and then draw water using reflection and refraction maps (3rd pass) • All perturbation occurs in pixel-shader • All 4 scrolling normal maps are sampled, the normals summed and normalized into single normal • Projective reflection and refraction map coordinates are perturbed by this normal • each is perturbed with a different scaling factor • Reflection and refraction maps are sampled and combined with their respective “water color”

  7. 3rd Time’s the Charm (cont.) • Fresnel term is calculated using the angle between the normal and the view vector • Creates for much more realistic “transparency” and lighting effects • Fresnel term defines the blending factor between reflection and refraction map • Looking straight down at water, water should look clear • Looking across/from the side, water should be highly reflective

  8. Where the Water Meets the Sky • Sky Dome • Needs sphere geometry • Possible with VS/PS1 in a single pass for sky color, sun, and moon • Uses projective texturing for sun and moon • Additional Normal mapping for moon • ADDSMOOTH color blending for sun • Prevents overflow for highly saturated colors when using additive blending • Instead of usual blending of ONE*SRC + ONE*DEST • Uses ONE*SRC + DEST*INVSRC • Base sky color uses simple 1D gradient function • Atmospheric color scattering performed in Vertex Shader

More Related