Friday 12 April 2013

ambient occulsion

OK, truth is I'm running out of ideas for these titles, just bare with me. So, obviously, this blog post is going to be about ambient occlusion. But what is ambient occlusion? you ask. Well, ambient occlusion is a method of computing shadows within a scene like shadow mapping but at the same time not like shadow mapping because of one major characteristic of ambient occlusion, which we will discuss later.

So, how does this thing work? The basic idea is that during the preprocessing of a scene each triangle (all models within a scene use triangles because triangles are the easiest shape to compute, and if you do not triangulate your models before using them you are a bad person)  of the scene is used to determine whether or not an area of the scene is being hit by light or not. To begin, calculations are made to determine the center of each triangle. Once this has been done we take the normals of these triangles at the points we just calculated and use them to project rays in random directions, taking care not to include results from rays that go into the model. These rays travel outwards from the center of their respective triangles and should a ray hit anything in the scene it has been determined that the triangle that that ray came from is occluded (at least for that ray). But if this is true then the effect ambient occlusion creates is blank and white with nothing in between. This is not so as the final step is to find the average of all the rays projected from that triangle this will give relatively nice looking shadows.

But as mentioned before there is a problem with ambient occlusion and it is that ambient occlusion is not light based but model based. In other words the outcome of AO is dependent on the characteristics of the model. Which should be fine until you have a light shinning right on top of where AO has determined that that a shadow must go. Despite this, ambient occlusion has its uses as it can be used to determine shadows for far away objects, or very large though any work regarding realistic graphics is not recommended as the GPU is capable of computing much more complex shadow algorithms.






Sources
http://academy.cg-masters.com/nicks-rants-and-raves/cg-myth-2-ambient-occlusion-shaders-are-awesome/
http://http.developer.nvidia.com/GPUGems/gpugems_ch17.html

No comments:

Post a Comment