NodeMaterials, Env Maps, Tonemapping and Exposure

Actually, the transmission extension creates a TransmissionHelper that is doing a rendering of all opaque objects in the scene (so the glass box is excluded) and then set this texture as the refraction textures of all transmissive materials (so, to the glass box).

You can’t replicate it by code because this class is hidden from the outside. The current implementation of the transmission extension is a kind of “work in progress”, I’m not sure it will stay as it is, I have heard that we may use another method (like screen space refraction) at some point…

The current problem is that this opaque texture is generated using the current setting of the scene, and notably the image processing setting: so it is rendered with tone mapping + exposure and converted to gamma space. This texture is used in the refraction code after it is converted to linear space, and in the end we apply the image processing to the final color.

To get the right output, I think we should:

  1. generate the opaque texture without applying the image processing and in linear mode
  2. when rendering the mesh with the refraction (opaque) texture, we should use the texture “as is” (as it is already in linear space) and apply the image processing to the final color.

Point 2 is easy as it is essentially what we are currently doing, we need simply to set gammaSpace = false on the opaque texture to avoid the conversion to linear space in the refraction code.

Point 1 requires a bit of thinking…

1 Like