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 3.1.3.1 shows the effect that sun sampling has on convergence speed for sunlit scenes.

Figure 3.1.3.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 3.1.3.2 shows the effect that disabling Sunlight sampling has on water.

Figure 3.1.3.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 Sunlight 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.1.3.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 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 3.1.3.4 shows a 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 3.1.3.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 3.1.3.5: Scene lit by emitters rendered to 610 SPP with ESS: NONE


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


Figure 3.1.3.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 produces 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 3.1.3.6, and can be very apparent when using ESS: ALL, as shown in Figure 3.1.3.7. Reduce either the Emitter intensity, the Exposure, or material emittance levels to compensate. This is a known bug, and we need to fix some maths to solve it.

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 will be fixed in a future release.

Figure 3.1.3.8: ESS ghost image lighting


2.5.0 Snapshots

Emitter Sampling Strategy was improved in the 2.5.0 snapshots, specifically in #1109. ESS no longer causes abnormally bright lighting on ESS: ONE or ESS: ALL, and ESS no longer projects the emitter lighting as a ghost image of the texture of the emitter onto other surfaces. Additionally, a new ESS method, called ONE_BLOCK was added. 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.

The following renders display the new effects of ESS. Each was rendered for approximately the same amount of time. Additionally, Prevent normal emitter when using emitter sampling was enabled to make the effects of ESS more apparent.

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


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


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


Figure 3.1.3.12: Scene lit by emitters rendered to 6 SPP with ESS: ALL

Just as in the Stable release, ESS: NONE is the quickest to render, but has the most noise. ESS: ONE is somewhat slower, and contains somewhat less noise. ESS: ONE_BLOCK is even slower to render, but contains even less noise. ESS: All is by far the slowest to render, but contains the least noise.


ESS Bugs

ESS is still imperfect, so there will still be bugs. 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.