Thursday, March 13, 2014

TD-U :: PRL :: Week 2 :: Ambient Occlusion

<<<--- THIS POST IS CURRENTLY BEING WORKED ON | EXPECT UNFINISHED SENTENCES AND LACK OF ORGANISATION --->

So this week's assignment is to research a bit in depth about the concept of ambient occlusion. There are two parts to the assignment. First is to research and find images which represent and demonstrate the concept of AO and how it exist in real life. In the second part we are supposed to find ways to get the desired results in CG.

I am going to start by bringing together all the information about AO that I can find so that I set a clear baseline regarding where my understanding is at the moment. I would then proceed on to doing the research.

There is surprisingly sparse information regarding this topic and most of the articles I found are technical descriptions of how it is calculated or how it can be included in real-time pipelines. There are not many resources guiding you how to use it artistically. I didn't find any specified workflow that shows you how to do it right.

What is Ambient Occlusion (AO)

For any given scene, we can calculate how much ambient light hits any given point on a surface. It represents how exposed is each part of the scene to ambient lighting. For a character, for example, more light will hit its head as compared to its armpit. The level of the ambient light is independent of the actual main light source used to illuminate the scene.

Ambient lighting, of course, is a lighting source that is, more or less, universal in nature, is not directional, and effects all the objects in the scene in a uniform way. It is like a light as found on an overcast day. So if you have a tube for example, it will receive less light on the inside as compare to outside. The deeper you go inside the tube, the darker it gets. As the name suggests, it is the degree of occlusion from the ambient light.

Left :: AO | Middle :: Lighting | Right :: Combined
AO doesn't give us clear shadows, but just darkens the enclosed and sheltered areas. It is a global method in the capacity that the illumination at each point is based on its relative position in the scene as compared with every other object. It is a very crude approximation of Global Illumination. The extra soft self-shadowing adds a lot of believability to lighting. Theoretically, the only correct use for AO is where lighting can be assumed to be constant and thus the directionality can be factored out.

How is AO Calculated

AO is related to accessibility shading.  It is a concept based on how easy is it to find a surface to be touched by various elements like dust etc. It works by firing rays in a hemisphere around each shading point on the model. If the ray hits a piece of geometry, it means something is blocking it and thus it is occluded. In this case a value of 1 is returned. If the ray doesn't hit anything and passes unimpeded into the environment, it is unoccluded an a value of 0 is returned. Then an average of this values returned by the rays is taken, over the number of samples specified by the user and it gives the final occlusion amount in the form of an image with a range from black to white.



Bent Normals

A natural extension to AO is bent normals. RenderMan implements this automatically. The idea is pretty simple. All the unoccluded  rays are are averaged to find the bent normal vector, also known as the 'average light direction vector'. This vector essentially just bends the currently shaded point's normal so that it looks at the position on the environment map from where the majority of light is coming from.

AO in Real Life

Ambient occlusion is essentially a CG topic. We try to better simulate nature by the use of AO. However, it is a very delicate component and looking at various examples over the last few days, I realized that a lot of artists tend to over-use or under-use it. After going through the basic concept of AO in CG, I started observing my immediate surroundings. I also took some pictures so I can freeze the moment and better analyse the conditions and lighting scenarios.



Types of Shadows

As AO primarily deals with shadows, let's talk about shadows first of all. As, we know there are basically 3 kinds of shadows in a normal lighting setup.
  • Cast Shadows: Shadows cast by the object as a direct result of blocking the light from a source. This shadow is generally cast on the object on which our subject is placed.
  • Form Shadows: Shadows that are found on our subject. These are found on the part of the object which is facing away from the light source. This shadow plays an important role in defining the shape of the object in question
  • Occlusion Shadows: These are mainly contact shadows. They are commonly seen in places where the materials push together in folds or at points of contact with the ground.


Challenges of AO

For me, the biggest challenge in dealing with AO in CG lighting is to separate the form, cast and occlusion shadows. Specially when dealing with a situation where the lighting is really diffused. For example, let's analyse a couple of images.




I came up with the following conclusions:

  • AO is directional
  • There are two main parts to it:
    • Contact Shadows 
    • Diffuse Shadows
  • It is not a one shot solution. AO is very specific to the lighting situation you are in. For example. AO in an exterior scene will take very different forms when lighting an overcast day or when lighting a bright sunny day.
  • In conclusion, AO is to be used very carefully. Before starting to light the scene a decision needs to be made regarding what part of various shadow components are to be handeled by the AO and what part by light based shadows. after care


References:
[1] Wikipedia
[2] http://renderman.pixar.com/view/image-based-lighting
[3] http://www.renderededge.com/2011/01/what-is-ambient-occlusion.html
[4] https://www.cs.unc.edu/~coombe/research/ao/
[5] http://zj.deathfall.com/depthbasedOcc.htm
[6] http://www.gamasutra.com/view/feature/2042/hardware_accelerating_art_.php
[7] http://www.andrew-whitehurst.net/amb_occlude.html
[8] http://http.download.nvidia.com/developer/GPU_Gems_2/GPU_Gems2_ch14.pdf
[9] http://http.developer.nvidia.com/GPUGems3/gpugems3_ch12.html

[10] Images from around the internet :)

Sunday, March 9, 2014

TD-U :: PRL :: Week 1 :: Images That Inspire Me :: Concept Art

Some interesting concept artwork that I found on the way.


















TD-U :: PRL :: Week 1 :: Images That Inspire Me :: Classical Paintings

Well it is safe to say that I have never really been an art enthusiast. So this was basically the first time I was looking at paintings closely and boy! did I enjoy it :)
I went to town on this one a bit. Please bear with me :)