Next Event Estimation (NEE)¶
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 220.127.116.11 shows the effect that sun sampling has on convergence speed for sunlit scenes.
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 18.104.22.168 shows the effect that disabling Sunlight sampling has on water.
Figure 22.214.171.124: 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
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.
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 126.96.36.199 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.
Chunky has three ESS settings. These are
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.
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.
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 188.8.131.52, and can be very apparent when using
ESS: ALL, as shown in Figure 184.108.40.206. 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.
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.
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 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.