Rendering Geometry with Relief Textures

Optimizations | Tuesday 28 October 2008 12:25 am

This is a special technique to do impostors. Instead of only storing the color of the object they also store the depth and the normals. The abstract:

“We propose to render geometry using an image based representation. Geometric information is encoded by a texture with depth and rendered by rasterizing the bounding box geometry. For each resulting fragment, a shader computes the intersection of the corresponding ray with the geometry using pre-computed information to accelerate the computation. Great care is taken to be artifact free even when zoomed in or at grazing angles. We integrate our algorithm with reverse perspective projection to represent a larger class of shapes. The extra texture requirement is small and the rendering cost is output sensitive so our representation can be used to model many parts of a 3D scene. “

Lots of cars rendered as impostors

Link to paper and more screen shots:
http://artis.inrialpes.fr/Publications/2006/BD06/

Please share:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Current
  • LinkedIn
  • Live
  • MySpace
  • Netvibes
  • StumbleUpon
  • Twitter
  • Reddit
  • Technorati
  • Yahoo! Bookmarks

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

Please share:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Current
  • LinkedIn
  • Live
  • MySpace
  • Netvibes
  • StumbleUpon
  • Twitter
  • Reddit
  • Technorati
  • Yahoo! Bookmarks

Normal map in 2 channels

Optimizations | Friday 3 October 2008 10:38 am

It’s possible to save the normal map in only two channels because of the fact that you know that the normal will be of unit length and pointing out from the surface. The technique is called hemisphere remapping and uses the following formula to unpack the third component from the two you saved in the normal map:

N.z = sqrt( 1 – N.x*N.x – N.y*N.y );

Because of the extra operations to get the third component, this method might not always be faster. And this method only works for tangent-space normals with unit length (but this is often the case).

Nvidia recommends the following texture formats to store the 2 channel normal map:

D3DFMT_V8U8 in DirectX

GL_LUMINANCE8_ALPHA8 in OpenGL

 

More information can be found in this GPU programming guide in chapter 4.11:
http://developer.download.nvidia.com/GPU_Programming_Guide/GPU_Programming_Guide.pdf

Please share:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Current
  • LinkedIn
  • Live
  • MySpace
  • Netvibes
  • StumbleUpon
  • Twitter
  • Reddit
  • Technorati
  • Yahoo! Bookmarks

Alpha Testing

Optimizations, Rendering Methods | Tuesday 30 September 2008 4:08 pm

When drawing for example lots of vegetation (with textures containing an alpha channel) you need to minimize overdraw and cost for each draw call. If you use blending for archiving the desired transparent effect on the leaves then you will need to sort all the triangles (back-to-front-order) to draw, (and sometimes this needs splitting of triangles) to get the correct look. Also when blending you might render the same pixel multiple times because you want the result to blend together. All this drawing and sorting takes a lot of time and a better way is to do alpha testing. In alpha testing (or alpha killing) you select an alpha threshold and all pixels with an alpha above (if you use GREATER as test function) this threshold will be drawn. Because no blending occurs, you don’t need to sort the triangles anymore (but preferably you will sort them front-to-back-order for optimization) . The drawback with alpha killing is that you will get sharp edges around the pixels drawn.
Alpha killing does not work with shadow volumes.

Alpha testing in OpenGL
http://opengl.org/documentation/specs/version1.1/glspec1.1/node96.html

Alpha testing in DirectX9 (in DirectX10 you must do your own implementation in a shader)
http://msdn.microsoft.com/en-us/library/bb172254.aspx

 

Please share:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Current
  • LinkedIn
  • Live
  • MySpace
  • Netvibes
  • StumbleUpon
  • Twitter
  • Reddit
  • Technorati
  • Yahoo! Bookmarks
« Previous PageNext Page »