On-GPU Ray Traced Terrain
Computer graphics course assignment I got to pick myself; I researched and implemented a method of drawing ray traced terrain on the GPU. Based on parallax occlusion mapping inside an unit cube, and similar to this Direct3D SDK example. It's limited compared to that (no shadows, etc.) but being that it was my first introduction to shaders and other modern graphics programming, I'm happy with it none the less.
I hope the code and/or report might be of use to someone since they're easier to understand than most other examples out there. To summarize:
- Only unit cube gets sent to GPU.
- Terrain is drawn in this, based on parallax occlusion mapping.
- Correct silhouettes as the terrain is drawn on all six cube faces. Skybox is shown outside terrain bounds.
- Occlusion with polygonal objects as depth is calculated.
- Deformation by offseting heightmap with a second texture.
- Angle-dependent sample rate and binary search step for improved performance/quality tradeoff.
- Diffuse and specular lighting by calculating normals from height map using a Sobel filter.
- No preprocessing of any kind (cone step mapping, normal mapping) and rather slow; realtime performance on fast machines though.
- No piecewise curve approximation, just pure sampling.