Instant Relighting & Nonphysical Effects

Today, we would like to give you a glimpse of one of the new features of our renderer.

Often, the image generated by the renderer contains all the effects you want, and looks roughly right. But you still may want to emphasize some areas, increase a highlight here, dim a caustic there, maybe tweak the color of a light source. You could modify your scene and re-render, but re-rendering frequently may be too costly. Image composition is often a cheaper alternative, and it lets you create effects which are not physically plausible. With iray, you can render different bits of information into different images. You can then use your favorite image manipulation software to tweak what you don’t like, without having to worry about breaking the things you do like.

Starting with iray 3.0 and the Iray Photoreal mode in Iray 2013, we support Light Path Expressions (LPEs), which allow you to do this separation. An LPE is a regular expression that matches some light transport paths that iray generates, but not others. Each result buffer can be associated with a LPE so that only paths which match the expression end up contributing to that buffer. Iray also allows you to render several buffers with different LPEs at the same time at almost no additional runtime cost. LPEs can distinguish between different surface properties such as diffuse or glossy, reflection or refraction, types of light sources, and names.

Some renderers use Arbitrary Output Variables (AOVs) to achieve a similar separation. While this allows access to some things that LPEs don’t give you, AOVs usually require modification of shader or material code. LPEs, on the other hand, can be used without modifying scenes or materials.

So, what do these expressions look like and how can they be used in practice? Take, for example, this image of a glass of whiskey illuminated by two light sources.

An abomination: whiskey on the rocks.

Let’s say we want to enhance the visibility of the caustic on the left and tweak the color of the rear light source. First of all, let’s get all contributions from the rear (environment) light source. We are interested in light emitted by the environment (Le) that bounces from any type of surface any number of times and then hits the eye (E). As in standard regular expressions, the dot character matches any interaction, and the star operator means “repeat any number of times”. So, we get "Le .* E" for our first buffer.

only light from the environment

The other light is an area light, so we can filter for La. Or, we can filter for the names of groups of lights as well as individual ones. The caustics we are interested in have had any number of arbitrary interactions with the scene before hitting a specular surface and then ending up on some diffuse (or glossy) surface. The corresponding LPE is "La .* S (D|G) E". Instead of (D|G), we can also use [DG] or [^S].

area light caustics

We can filter all the other paths into the final buffer, for example, by specifying "La (.* (S | [^S] .) | .?) E".

non-caustics area light contributions

Now, we can modify and recombine these images in any way we want. 75% environment contribution, 110% area light caustics, 100% other area light contributions:

brighter caustics, darker environment

50% environment contribution tinted blue, 100% area light contribution tinted orange:

tinted lights

60% environment contribution, 30% area light caustics tinted orange, 100% other area light contributions tinted orange:

weaker caustics

Depending on the operations we apply, the result is exactly the same as re-rendering with the corresponding operations on the scene. But it’s instantaneous and no re-rendering is necessary. In addition, we can achieve a look that we cannot get directly from simulated light transport.

Remember to disable tone mapping and gamma correction during rendering and apply it after compositing.

——

Daniel S.