Ambient Occlusion



Table of contents:


Description:
This node is basically an accessibility shader, i.e. it will darken those areas which are more or less hidden and keep the open areas white (colors can vary depending on your settings).

Warning: Any scenes, models or surface presets of any kind created with versions prior to 1.0 of this node pack will NOT work anymore and have a high chance of crashing LW. Please write down settings manually to transfer them to this version.
Example

Location:
The node will be added to the "Pom's Nodes/Surfacing" menu under the name "Ambient Occlusion".
Random:
In this mode rays will be shot into the scene in a random direction (but residing inside the cone with the angle from "Cone Angle" (see below).
You could also call this the brute-force mode as it can take quite an amount of samples to get a noise-free image :-D.

Samples:
Defines the number of rays which will be cast.

Cone Angle:

Maximum angle between the surface normal and the ray which is tracing the occlusion (second picture on the right: cone angle marked in green).

Ranged / Max:
If ranged is checked, occlusion is only calculated for the range defined by "Max". If not, occlusion will be calculated in an infinite range (weighted style will be lost in this mode).

Shift:
A negative value darkens the occlusion output and a positive one brightens it respectively.

Clamp Low / High:
Clamps the value of each sample (not just the final output) to the given values. Only useful for shift-values not equal to 0.

Offset:
The distance from the surface from which rays will be cast. Helps to get rid of shading issues, especially with double sided surfaces.

Sample Depth:
Specifies up to which ray recursion depth this shader will take samples when shaded by sampled sources (like blurred reflections or even itself, but only in RayTrace mode. See color settings). When this limit is exceeded, "Limit Color" from color settings will be returned.


Random

Cone angle


Polar:
Unlike the Random-Mode, this mode guarantees a somewhat equal distribution of the sample-rays resulting in a much cleaner image with the same amount of samples.
To give you an idea of how this equal distribution is achieved it's best to imagine a (hemi)sphere you created in modeler (in "Globe" mode NOT "Tessellation"):
Let's say you created a hemisphere with 6 sides (and therefore 6 "corners" where the vertices are) and 3 segments in the center of the coordinate-system (both illustrated by the red curves in the second picture on the right). This node would then shoot out rays from the origin <0, 0, 0> towards each of the hemisphere's vertices (green arrows/intersections of the red curves).
The downside of this mode is that depending on the settings you will see more stepped effect in zones with a transition from an occluded area to an area which is not occluded (in this case you should play around with the jitter angle and the number of samples).

Polar Samples 1:
Indicates the number of  samples taken between the normal of the shaded point and the cone angle (blue arrow). The first sample is always taken from the direction of the normal.

Polar Samples 2:
Number of samples taken around the normal of the currently shaded point (yellow arrow).

Jitter Angle:
This angle describes how many degrees the rays are allowed to be rotated away from the original direction. The rotation can occur to be both clockwise and counter-clockwise (depends on the internal randomly generated number) in horizontal direction, but vertically ONLY from the original direction upwards towards the normal so that samples taken stay inside the cone angle.


Polar

Polar sphere


Color Settings:
In this panel you can set various colors, which will be used to calculate the color output of this node.

Color Modes:
Custom: the user-defined color will be used.

Backdrop: the color of the background of the scene in the direction of the ray will be used.

Trace: a raytraced color will be used. Useful for color-bleeding effects, but slower.

Brightness:
The corresponding color will be multiplied with this value.

Surface Color:
This color is only used in ranged mode (see above). It's used when a sample ray hits something in the scene within the user-defined range. The color output for such a spot would be:

occlusion color * occlusion + surface color * (1 - occlusion)

Where occlusion = 1 - (distance travelled) / (maximum distance) +/- shift

The latter formula is why this surface attribute is only used in ranged mode.

Background Color:
Color for areas which are not occluded (sample-ray goes into infinity and therefore hits an imaginary sky/background).

Occlusion Color:
Color for occluded areas.

Limit Color:
This color will be returned, when this shader is evaluated by a sampled source (blurry reflections etc.) and the ray recursion depth is higher than "Sample Depth" in the sample settings.


Color Settings
Other inputs:
Function:
This input lets you override the default function used to weight the occlusion samples in ranged mode (described above under "Surface color").

Normal:
This input can be used to override the surface normal, which is used during occlusion calculations.