Occlusion

Description

Name

class Tinman.Pixel.Occlusion

Derived from

Pixel

Creates a pixel layer that renders ambient occlusion terms as grayscale pixels into the output pixel buffer (black := fully occluded, white := no occlusion).

Ambient occlusion is computed by casting 16 rays (see 0.. F) per pixel (see x), collecting the horizon angle for each one. The resulting ambient occlusion term is the average horizon angle (i.e. 0 means no occlusion at 0°, 1 means maximum occlusion at 90°).

+---+---+---+---+---+
| A | B | C | D | E |
+---+---+---+---+---+
| 9 |   |   |   | F |      |
+---+---+---+---+---+      |
| 8 |   | x |   | 0 |   ---+--> X
+---+---+---+---+---+      |
| 7 |   |   |   | 1 |      V
+---+---+---+---+---+      Y
| 6 | 5 | 4 | 3 | 2 |
+---+---+---+---+---+

The range parameter can be used to speed up computation time, at the cost of accuracy. In combination with the padding parameter, the generated pyramid tiles will be seamless iff range is not zero and less than or equal to padding.

Fields / Optional

pad

Type

number

Default

0

The amount of padding to use.


range

Type

number

Default

0

The maximum distance (in pixels) that a ray may travel before being discarded. If 0, rays will never be discarded.