Friday, March 30, 2007

36RSO Project progress 2

Last 2 weeks
  • revised existing shading
  • studied appropriate shading methods for geometry clipmaps
  • implemented shading using normal maps computed on GPU (user can change normal map resolution)
  • implemented 'on-the-fly' shading on GPU (2 possible ways of normal computation)

Next 2 weeks
  • implement supersampled normals using both ways of shading
  • try to make on-the-fly shading more effective
  • study possible ways of synthesizing terrain on GPU
  • modify existing clipmap code to enable reading height values from synthesized source, not only heightmap

TerraD3D Shading 1 (v1.04)

Implemented two different ways of shading - using normal maps and on-the-fly.

Normal maps define one normal per vertex and are computed during clipmap update. Asirvatham and Hoppe use double resolution normal maps but these form undesirable blocks. Normal maps are computed in vertex shader and rendered to a texture, during rendering the pixel shader simply samples the texture and computes a color. Normal maps require the same amount of video memory as height maps (4 times more for double resolution) but provide very fast way of shading.

The second way is to compute normals on-the-fly in vertex shader reading several height samples (currently 4) to obtain a normal, which is then sent through pipeline to pixel shader. No extra memory is needed but vertex texture lookup is still very expensive and framerate drops down to 50% compared to normal maps. It would be interesting to find out if only 2 extra texture lookups can produce similar shading quality.

Normal maps - close

On-the-Fly - close

Normal maps - far

On-the-Fly - far


Normal maps form block artifacts at close views, on-the-fly method provides best results with higher vertex density. Blending both methods could be the way to go (http://www.robertwrose.com/cg/terrain/rose-geoclipmaps.pdf).

TerraD3D v1.04 binary here (~4.5MB)
Shading techniques can be changed in console using clipmap.render_texhnique command with parameter render for normal maps and render1 or render2 for on-the-fly method. clipmap.normal_res_double turns on/off double resolution for normal maps.