Mar 12 2007

Static Ambient Occlusion

Published by Renaud Bédard at 08:25 under HLSL, Samples, TV3D 6.5, VB.NET

Traditional DirectX lighting models define ambient lighting as coming from all directions, and is added as a constant on all surfaces regardless of the geometry. Ambient occlusion acts as a factor to ambient lighting to take into account the cavities and concave areas in a model, or how much a surface is hidden from its environment.

Downloads

StaticAmbientOcclusion.rar [6.8 Mb] – VB 2005 (VS.NET 2005)

Features

  • Two computation modes : Both raytracing (CPU, software) and hemicube rendering (GPU, hardware) modes can be chosen to compute the occlusion data. Hemicube mode is much faster but slightly less accurate.
  • Occlusion data saved in TVM : The mesh vertex color information is used to save and use the occlusion data, so it can be generated once and saved along with a TVM.
  • Multithreaded raytracing : Even if it’s slower than hemicubes, the raytracing mode has been optimized for multi-core configurations with as many threads as wanted.
  • Fully featured shader : A shader is unavoidable to actually show the ambient occlusion when rendering, so I’ve made a proper one. It features 4 lights in SM3 and 2 in SM2 and offset bump-mapping, which makes it pretty much the same as TV3D’s built-in mesh shader.
  • Bent normals : The raytracer can compute the bent normal, or “direction of least occlusion”, and stores it in place of the mesh’s normal.
  • Tweakable diffuse occlusion factor : A shader parameter allows to set the amount of diffuse occlusion.
  • Lyon/Blinn reflection model : The TV3D built-in shader uses the Phong reflection model, but my shader uses a reformulation of Blinn-Phong which leads to a more correct shape of specular highlights.

Screenshots



3 responses so far

3 Responses to “Static Ambient Occlusion”

  1. Pat/Hawthorneon 01 May 2008 at 05:16

    Superb as always zak.

    -Pat

  2. jeremie mangueon 18 Oct 2009 at 21:07

    hello,

    I was wondering if you could port this simple example on xna ? It’s basically the only sample I found on this technique.

    cheers

  3. Renaud Bédardon 20 Oct 2009 at 14:55

    I’m putting together a framework for XNA, so yeah I might do that in the near future. :)

Trackback URI | Comments RSS

Leave a Reply