Emission Importance Sampling#
Emission paths are amongst the most challenging paths to resolve by path tracers. Indeed, emissive surfaces are "accidentally" discovered during material sampling when firing rays from the shaded surface during material sampling since renderers have no knowledge of where emissive surfaces are located in the scene.
While this works well enough for low intensity emissive sources, it scales terribly with high intensity ones such as street lights producing a lot of noise in renders. Unfortunately, the only way to clean this noise is then to massively increase the Material Sample Count via brute forcing which can lead to crazy render times to become almost impractical.
Example of a scene lit by emissive surfaces. Despite using 200 spp the path tracer still fails to resolve the noise
Not a single light was used in all the renders of this page.
To overcome this issue, renderers historically introduced the concept of render lights which are simple emissive shapes explicitly created by users. Renderers could then identify and sample efficiently these explicit surfaces to resolve illumination and greatly reduce noise. However, this technical constraint makes the work of lighting more difficult.
Artists are forced to manage more lights than they should in order to approximate the light coming from the emissive surfaces in the scene. For example, to approximate the illumination of the headlights of a car, they must manually place render lights at the correct position instead simply defining the emissive property of the headlights material during lookdev. This work is very tedious, cumbersome and time-intensive and there are many other things to consider such as the management of the occlusion/emission between the emitting geometry and the manually placed light.
Fortunately, Clarisse's path tracer provides a special rendering technique called Emission Importance Sampling (EIS) designed to alleviate this problem. The idea behind EIS is to internally consider each emissive primitive as a virtual light source. While the idea sounds easy, in reality, the naive implementation quickly ends up generating millions and even billions of virtual light sources on production scenes. However, thanks to some internal heuristics the path tracer can still gracefully sample the scene despite the apparent complexity.
As a result noise is greatly reduced, render times and memory usage are kept reasonably low despite a very high number of virtual light sources present in the scene.
EIS doesn't importance sample emission emitting volume and curve geometries.
Emission Sample Count#
To turn on EIS, you simply need to allocate samples to the Emission Sample Count attribute of the path tracer. This value defines how many samples the path tracer uses to sample all the emissive surfaces of the scene.
Please also note that the number of specified samples directly impacts quality and render times: the higher the value is, the less noise you will get from emissive surfaces and the longer render time gets.
This setting is global for the scene: the path tracer automatically distributes the samples to the proper emissive surfaces for each shaded point according to some internal heuristics.
Please note that it is also possible to locally define the number of samples on Scene Objects. This way they aren't sharing the global sample count set in the path tracer. This can be useful to improve further rendering quality in some scene configurations. Please refer to Overriding Emission Importance Sampling section for more information.
All the renders below have no lights and have been rendered with a Material Sample Count set to 4 spp
- When Emission Sample Count is set to 0 spp EIS is turned off. Emissive surfaces are randomly sampled during material sampling.
- When we set Emission Sample Count to 1 spp, the path tracer can use a single sample per pixel to perform EIS. Depending on the shaded point the path tracer either samples the plane or the sphere according to some heuristics.
- When we set Emission Sample Count to 4 spp EIS yields better results.
Emission Color and Weight#
Emission is split between two main attributes: Emission Color and Emission Weight which are available in pretty much all physical materials offered by Clarisse. Emission Color defines the actual color of the emission while Emission Weight defines the weight or intensity of the emission.
The final emission of a surface is always the result of the Emission Color multiplied by the Emission Weight.
It is very important to note that for best results, you need to enable Emission Texture Importance Sampling when one or both Emission Color and Weight are driven by a texture operator. If you don't the path tracer will fail to provide good results since it won't be able to approximate the intensity of the emissive surfaces. Please refer below for more information.
Emission Texture Importance Sampling#
When enabling emission texture importance sampling the path tracer can greatly reduce the amount of noise of textured emissive surfaces.
Below are two renders with and without Emission Texture Importance Sampling:
By default, emission texture importance sampling is disabled. To enable it, you need to set the Emission Texture Importance Sampling attribute of the Scene Object to one of the following modes below:
|Emission Texture Importance Sampling||Description|
|None||No texture importance sampling is performed.|
|Color||Emission Color input textures of all the materials assigned to the scene object are importance sampled. This mode should be used when only the Emission Color of the material is textured which is typically the case when using an HDR texture encoding both color and intensity.|
|Weight||Emission Weight input textures of all the materials assigned to the scene object are importance sampled. This mode can be useful when you explicitly want to vary the color texture according to a spatial projection based on the position of the instance such as world projections, texture switch or instance color for example.
Please note that setting this mode while texturing Emission Color can lead to a degradation of the quality of the importance sampling if the intensity/weight component is encoded to the color textures.
|Both||Both Emission Color and Emission Weight input textures of all materials assigned to the scene object are importance sampled. This mode should be used when using specific textures for Emission Color and Emission Weight.|
Due to memory constraints consideration when instancing geometries, emission color and weight texture projections are forced in to be evaluated in object space when importance sampled. This means that all types of projections should work with the exception of world space and camera projections on which the texture is evaluated as if the object was located at the origin of the world. Also no view/incidence dependent texture nodes can be properly taken into account for importance sampling.
Emission Texture Importance Sampling set to Weight. Noise is resolved quite well when no texture map is used in the emission color channel.
Emission Texture Importance Sampling set to Weight while still texturing the Emission Color. Note the additional noise compared to below.
Using both a color and weight map with Emission Texture Importance Sampling set to Both. Noise is perfectly resolved.
When emission importance sampling is enabled the path tracer needs to evaluate as a prepass the texture operators driving Emission Color or Emission Weight at the center of each primitive of the geometry. This is done automatically depending on the mode selected in Emission Texture Importance Sampling.
Since the texture(s) are evaluated at the center of each primitive of the underlying geometry, the number of primitives then directly defines the precision/resolution of the sampling of the shading network used for emission.
This is very important to remember when your shading network used for emission relies on shading point positions such as when using texture maps, procedural textures etc... In that case, you need to make sure there are enough primitives in the geometry, so that the path tracer gets enough information to properly perform importance sampling.
As a general rule, the more primitives there are in the geometry, the more accurate results are. Actually to make it simple, just imagine that each primitive is a single color area light. For example, if you are using a 512x256 emission texture map on an entire polygrid you'll need to set its Spans attribute to 512 and 256 to retrieve all the small details available in the texture.
If the underlying geometry doesn't have enough primitives, it is possible to increase the subdivision using Subdivision Surfaces on all polygonal meshes. However, since it is not possible to increase the number of primitives on implicit geometries such as implicit spheres, box and cylinders, it is best to use their polymesh counterparts instead.
Enabled Subdivision Surface and Tessellation level to 5. When the geometry is correctly tessellated the results are accurate.
With a too low tessellation, the lighting is darker than expected and more noise is visible.
Going further with Texture Importance Sampling#
Internally, Clarisse performs emission importance sampling based on the intensity of the emission. The Color and Both modes of the Emission Texture Importance Sampling are provided for workflow convenience.
As a matter of fact, it's best to work in Weight mode when possible to maximize the sampling quality and the prepass performance. In that case, you need the emission color to define chromaticity (actual color separated from its luminance/intensity) and an emission weight texture defining the intensity. More importantly doing so allows to make hue operations on a color texture defining chromaticity while ensuring the best sampling possible.
Thankfully Clarisse provides two dedicated texture nodes to simplify the extraction of the chromaticity and weight from any input texture:
- GetEmissionColor that extracts the chromaticity (color without its intensity component).
- GetEmissionWeight that extracts the emission weight of the color.
For more information please refer to Get Emission Color/Weight section.
Overriding Emission Importance Sampling#
By default, the path tracer uses an heuristic to automatically decide how many samples are allocated to the emissive surfaces of the scene. While quite efficient, this heuristic can fail in some scene configurations leading to poor sampling and noise. One of the most challenging configuration is scene configurations where emissive surfaces are occluded. Indeed since the path tracer doesn't have any knowledge of occluders, it may choose to sample emissive sources that are occluded. This can happen in scenes that have small emissive sources inside a room while having at the same time strong ones outside located behind the walls.
Cornell Box with 2 emissive surfaces inside and a strong yellow one outside
While for us it is pretty obvious that the emissive source outside isn't going to affect the lighting, the path tracer needs to rely on ray tracing to detect occlusion. In this scenario, the path tracer heuristic will allocate many samples to the strong emissive source outside the room, ray trace and reject the samples because of the occlusion.
This obviously wastes many samples since the sampling of the strong emissive source is favored instead of the smaller ones inside that are the important ones!
In these types of situations it is possible to help the path tracer by disabling the emissive importance sampling of the scene object located outside. To do so, just select the scene objects located outside and uncheck their Emission Importance Sampling attribute.
Poor sampling because many samples are wasted on the emissive surface located outside
Same scene but disabling Emission Importance Sampling on the emissive surface outside.
Occlusion isn't the only factor that can give the path tracer a lot of trouble to identify the important emissive surfaces. Here are the most common cases:
Lot of regularly spaced surfaces with low emission intensity. Typically a scene where many low emissive objects are scattered relatively close to each other while the camera is being close to the surfaces.
Emissive surfaces reflected on a glossy surface with roughness levels between 0% and 50% and viewed from a glancing angle. Typically street lights located far away from the camera that are reflected on a wet road.
Many emissive surfaces close to each other with the same intensity. EIS has hard time to resolve noise.
When disabling EIS the material sampling does a better job for the same render time.
Low roughness specular paths on glancing angles are very challenging for EIS
With the same render settings EIS does a much better job with higher roughness specular paths
In these cases, it is possible to directly set the number of samples at the scene object level to have finer controls over the quality of the sampling to reduce noise.
To override the Emission Sample Count on a specific scene object that would need more samples, just select it and set its Emission Sample Count attribute to the appropriate number of samples.
The path tracer will then exclude such objects from the global EIS sampling to individually sample them using the number of specified samples defined on each scene object.
Sample Count: Material 16 spp Emission 8 spp shared on spheres and plane
Sample Count: Material 16 spp Emission 8 spp shared on spheres and Plane set to 64 spp Emission
Combiners and Scatterers#
Like any other scene objects, it is possible to override the Emission Sample Count attribute on Combiners and Scatterers so they can be sampled independently from the emissive surfaces of the scene. However, they offer an additional attribute Emission Importance Sampling Mode which controls how their instances are sampled.
|Emission Importance Sampling Mode||Description|
|Use Sub Items||Sample instances according to the value of the Enable Emission Importance Sampling attribute defined on the sources. If the sources have their Emission Importance Sampling disabled then they are traditionally sampled, otherwise they are importance sampled.|
|Force Importance Sampling||Force each instance to be emission importance sampled when instantiated by the combiner/scatterer.|
|Disable Importance Sampling||Force each instance to be traditionally sampled when instantiated by the combiner/scatterer.|
The value of Emission Sample Count set on sources items that are combined or scattered is ignored by the path tracer to avoid large numbers of samples. Indeed, let's imagine if one of the instances of the scatterer scattered 1,0000,000 times had a Emission Sample Count set to 64 spp. If the path tracer was taking into account this value, it would lead the path tracer to sample such a scatterer 64 million times per pixel!