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 four ESS settings. These are NONE, ONE, ONE_BLOCK, 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: ONE_BLOCK, every face of a 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:ONE_BLOCK is even slower per sample than ESS: NONE, but potentially even 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. Prevent normal emitter when using emitter sampling was enabled to make the effects of ESS more apparent.

Figure 9: Scene lit by emitters rendered to 64 SPP with ESS: NONE


Figure 10: Scene lit by emitters rendered to 42 SPP with ESS: ONE


Figure 11: Scene lit by emitters rendered to 18 SPP with ESS: ONE_BLOCK


Figure 12: Scene lit by emitters rendered to 6 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: ONE_BLOCK is even slower, but noise is further reduced. ESS: ALL is by far the slowest to render, but it results in the least noise.

ESS Bugs

ESS was improved in the 2.5.0 snapshots; however, it is still imperfect, so bugs still exist. When ESS is enabled, the lighting from the emitters is somewhat unrealistically projected compared to if it is disabled. Disabling Prevent normal emitter when using emitter sampling can make the lighting more realistic, but the scene must be rendered for a longer period of time to reduce noise.