Skip to content

Next Event Estimation (NEE)

Sunlight Sampling

Scenes rendered with sunlight enabled do not typically require to be rendered to a high SPP count to yield a nice image. This is due to Sunlight sampling, otherwise known by its more technical name, Next Event Estimation (NEE), which is enabled by default. With every ray intersection, the sun is sampled, due to NEE adding its contribution to the ray without the need for it to be hit directly as in random sampling. Figure 1 shows the effect that sun sampling has on convergence speed for sunlit scenes.

Figure 1: Sun sampling reduces noise in much fewer samples than if it were disabled

However, Sunlight sampling has the drawback of being unable to produce certain visual effects, caustics and reflections under and above water being some of them. Figure 2 shows the effect that disabling Sunlight sampling has on water.

Figure 2: Disabling Sunlight sampling allows rendering of certain visual effects, such as caustics.

Sunlight sampling can be disabled in part or in whole by using 2.5.0 snapshots and setting Sun Sampling Strategy to HIGH_QUALITY or OFF, respectively. However, as previously stated, disabling Sunlight sampling in sunlit scenes will require very many more samples to converge than sunlit scenes rendered with Sunlight sampling enabled.

Emitter Sampling Strategy (ESS)

Scenes lit by emitters (torches, lava, glowstone, etc.) require many more samples to converge than scenes lit by the sun and sky do, since NEE is not enabled for emitters by default, due to reasons explained in the paragraphs following. Instead, the ray must intersect the emitter directly for it to contribute lighting to the scene, which has a lower probability of occurring, especially with smaller emitters, such as torches.

Emitter Sampling Strategy (ESS) enables an "optimized" NEE, similar to the sampling which the sun uses, and, in theory, should lead to faster convergence.

Figure 3: Scenes rendered with ESS converge in fewer samples

Whereas there is only a single sun present in the scene, there can be multiple emitters, some of which at distances where they will not contribute much to the pixel being sampled. Sampling every emitter in the scene would require much more computing power, so to counter that, Chunky uses the emittergrid, which divides the world into an array of cubic sections, called cells. The emittergrid records to each cell the locations of every emitter within that cell and the cells adjacent, and saves them to that cell's entry in the emittergrid file. The reason Chunky records emitter location data of emitters in adjacent cells is that an emitter near the edge of a cell will be able to cast noticeably-bright light into the adjacent cell.

When a ray intersects the scene, Chunky reads from the emittergrid the emitter location data for the entry of the cell in which the ray intersected the scene, and samples the emitters recorded for that cell. Every emitter at cellSize (Emitter grid size) or fewer blocks away from the ray intersection point will always be sampled. The maximum distance an emitter can be sampled from is 2 * cellSize - 1 blocks away from the intersection point, which happens if the ray intersects the scene near the edge of a cell. This way, the cost of processing the additional samples is minimized compared to if Chunky sampled every emitter.

Figure 4 shows a simplified diagram of how ESS works. The white dot is the point where the ray intersected the scene. Only emitters within the green cell, in which the ray intersected the scene, and the blue cells, which are the adjacent cells, are sampled. The emitters within the red cells are "too far away" to contribute much lighting, and are not sampled.

Figure 4: Emittergrid diagram

Chunky has three ESS settings. These are NONE, ONE, and ALL. With ESS: NONE, ESS is disabled. With ESS: ONE, only a single randomly-selected emitter within the cell of intersection and its adjacent cells is sampled per ray intersection. With ESS: ALL, every emitter within the cell of intersection and its adjacent cells is sampled per ray intersection. Sampling emitters increases the computing cost per sample, but can reduce the total number of SPP required to converge. Render speeds vary from scene to scene, but generally, ESS: ONE is slightly slower per sample than ESS: NONE, but potentially faster to converge. ESS: ALL is the slowest per sample, but potentially fastest to converge.

The following renders demonstrate the effects of ESS. Each was rendered for approximately the same amount of time.

Figure 5: Scene lit by emitters rendered to 610 SPP with ESS: NONE

Figure 6: Scene lit by emitters rendered to 460 SPP with ESS: ONE

Figure 7: Scene lit by emitters rendered to 45 SPP with ESS: ALL

ESS: NONE is the quickest to render, but has the most noise. ESS: ONE is somewhat slower, but noise is reduced. ESS: ALL is by far the slowest to render, but it results in the least noise.

ESS Bugs

When ESS is enabled, it can increase the brightness of emitter lighting. This is apparent to a lesser extent when using ESS: ONE, as shown in Figure 6, and can be very apparent when using ESS: ALL, as shown in Figure 7. Reduce either the Emitter intensity, the Exposure, or material Emittance levels to compensate. This is a known bug, and was fixed in the 2.5.0 snapshots.

ESS also has the unfortunate problem of projecting the lighting as a ghost image of the texture of the emitter onto other surfaces. This is due to a bug, and it was fixed in the 2.5.0 snapshots.

Figure 8: ESS ghost image lighting