Basic Shadow Mapping

Shadow Mapping | Thursday 23 October 2008 1:28 am

Shadow mapping works in that it checks if a point is visible from the light or not. If a point is visible from the light then it’s obviously not in shadow, otherwise it is. The basic shadow mapping algorithm can be described as short as this:

  1. Render the scene from the lights view and store the depths as shadow map
  2. Render the scene from the camera and compare the depths, if the current fragments depth is greater than the shadow depth then the fragment is in shadow
Shadow mapping example

It’s the implementation of it that is hard.

The two big problem areas with shadow mapping:

  • Hard to select an appropriate bias (epsilon)
  • Hard to get rid of artifacts at shadow edges

Projective texturing ( the method used to transform the fragment depth to the light space (where the shadow map is) for comparision)
http://developer.nvidia.com/object/Projective_Texture_Mapping.html
http://en.wikipedia.org/wiki/Projective_texture_mapping

OpenGL fixed-function pipeline implementation of shadow mapping:
http://www.paulsprojects.net/tutorials/smt/smt.html

A GLSL implementation of shadow mapping (in one of the posts)
http://www.gamedev.net/community/forums/topic.asp?topic_id=316147

Another GLSL shadow mapping shader:
http://sombermoon.com/shadowmappingdoc.html

DirectX9 shadow mapping example with source
http://msdn.microsoft.com/en-us/library/bb147372(VS.85).aspx

Nvidias implementation of shadow mapping with source for both OpenGL and DirectX.
http://developer.nvidia.com/object/hwshadowmap_paper.html

Shadow mapping in XNA
http://www.riemers.net/eng/Tutorials/DirectX/Csharp/Series3/Shadow_mapping.php
http://msdn.microsoft.com/en-us/library/bb975671.aspx

Instancing

Optimizations | Tuesday 21 October 2008 11:37 pm

Instancing is a new way to offload the CPU from some work when rendering many copies of the same geometry.  It does it by reducing the overhead of drawing multiple copies of the same vertex buffer.

In OpenGL it’s only fast to use instancing when the instanced mesh consists of very few triangles.

Nvidias instancing demo, here with 136499 meshes rendered at once with 24 triangles per mesh. It runs at 20 fps stable on a GeForce 8800 GTS. (left image is all objects viewed from far away, right is zoomed in)

Instancing

A image from Microsofts DirectX10 instancing demo

Instancing

Some test made that shows when to use instancing and when not
http://www.ozone3d.net/blogs/lab/?p=87

HLSL instancing (therefore DirectX)
http://developer.download.nvidia.com/SDK/9.5/Samples/DEMOS/Direct3D9/
src/HLSL_Instancing/docs/HLSL_Instancing.pdf

Nvidias DirectX10 implementation of instancing
http://developer.download.nvidia.com/SDK/10.5/direct3d/Source/InstancingTests/
doc/InstancingTests.pdf

Microsofts DirectX9 instancing sample
http://msdn.microsoft.com/en-us/library/bb174602(VS.85).aspx

Microsofts DirectX10 instancing sample
http://msdn.microsoft.com/en-us/library/bb205317(VS.85).aspx

An OpenGL implementation of a pseduo-instancing (recommended for old hardware).
http://http.download.nvidia.com/developer/SDK/Individual_Samples/
DEMOS/OpenGL/src/glsl_pseudo_instancing/docs/glsl_pseudo_instancing.pdf

OpenGL instancing:
http://www.opengl.org/registry/specs/EXT/draw_instanced.txt

Procedural Approach to Animate Interactive Natural Sceneries

Vegetation | Saturday 18 October 2008 12:53 am

This algorithm for rendering grass allows user interaction with the grass which most other methods won’t. They call this interaction effect treading and it’s implemented as a scalar field which determines in which direction the individual grass straws should bend.

Interactive grass rendering

Link to the paper, more screenshots and movies
http://www-evasion.inrialpes.fr/Publications/2003/GPRFC03/

Rendering Countless Blades of Waving Grass

Vegetation | Saturday 18 October 2008 12:43 am

A full article that presents every aspect of implementing billboarded grass fields in games. It uses a vertex shaders for animating the grass in the wind.

A grass rendering

Here’s the full article for free (also the source for the image). Or you could buy the great book “GPU Gems 1″ which also contains the article.
http://http.developer.nvidia.com/GPUGems/gpugems_ch07.html

An implementation of the grass rendering by Nvidia:
http://developer.nvidia.com/object/nature_scene.html

« Previous PageNext Page »