Setup Materials

We’ll discuss general material setup and define some guidelines that may help in defining high quality materials.

A Word on Color Saturation

The amount of ( red, green, blue ) components in a diffuse color will define it’s behavior for the rendering. Saturated colors may behave badly in a photo-realistic rendering, because this means that no absorption by the material occurs. Let’s look at the example below:

../../../_images/color_saturation.png

Effect of color saturation on the rendering

We can see that a “pure” diffuse white color (here defined using 8 bits values) set to ( 255, 255, 255 ) cause a lot of energy to be preserved by the global illumination phase and carried out at every position in the scene. This is the expected behavior: a ray bouncing on a surface sees all its energy re-emitted - unmodified. In the example above, the box in which the light is set is closed (we see it from the outside with single sided walls). Therefore, the energy bounces infinitely and causes a lot of whiteness in the resulting image. The middle and right images show the difference if we slightly desaturate the color. In the middle image, the color value is ( 254, 254, 254 ), and we see a big difference compared to the first image, despite an intensity change of less than 0.4% in the color. Similarly, using a color set to ( 250, 250, 250 ) lead to a desaturated image, where the whiteness is only visible in really lit area (here: just below the light source).

So if we keep in mind that the global illumination phase in the rendering of an image is a calculation process that determines the amount of energy reaching every point in the model, then it clearly appears that if we have materials that have no absorption, we’ll propagate a too wide amount of energy throughout the model.

Energy Preservation Rules

Therefore, a material should have the sum of its diffusion, reflection and transmission terms lower than 1.

The realistic material makes sure that the sum of the three components in the material is at most equal to 1. It does not desaturate the material, but it avoids having it generate energy if for a given shaded fragment, the sum of the three components exceeds 1. The generic material does not enforce any energy preservation rule.

Texture Resolution

If you have thousands of old and ugly 256 x 256 textures; just get rid of them. They’re worthless in the setup of high quality materials. A basic rule to enforce here is that the resolution of the texture should not be lower than the number of pixels it’ll occupy on screen. So, the texture of a floor should be around 4096 x 4096, or 2048 x 2048 at the minimum; but the texture of a small decorative object may perfectly fit on a 256 x 256 bitmap for most use cases.

Saving memory is important as there may be thousands of textures loaded for the rendering of a single scene, so adjusting the texture sizes may allow using less memory for the rendering of a scene.

Let’s see a concrete example of a quality loss due to low resolution textures, on a simple HD rendering (1920 x 1080). The original floor texture resolution is 2048 x 2048, and we reduce it down to 512 x 512:

../../../_images/texture_resolution.png

The effect of texture resolution on the rendering quality.

As soon as the texture resolution is lower than the coverage of the texture in the final image, we start seeing artifacts. At a first look the 1024 x 1024 texture quality could look correct, but the relief of the bump start to be visible for what it is: a bump, not real modelling.

Fresnel Term for Dielectric Materials

The simulation of a Fresnel term is very important in terms of visual realism. A glass rendered without any Fresnel term will never look realistic. Without getting into the technical equations behind, the Fresnel effect for dielectric material changes the amount of reflection and transmission of the material based on the viewing angle. That’s why if we consider the glass ball below, it looks more reflective on its sides:

../../../_images/fresnel.png

The left ball has a Fresnel effect applied to it, the right one does not use Fresnel.

Most materials are reflective due to a coating applied to them. A wood floor is not natively reflective. The varnish applied to it make it reflective. In computer graphics, we do use a Fresnel term on the wood material directly, because the coating is implicit: there’s no modelling skin of varnish applied over the flooring. So most materials that are reflective due to the application of a varnish should use a Fresnel term for the evaluation of their reflection amount.

Metals are among the exceptions. A metal may be reflective on its own, and the reflectance model of most models does not need any Fresnel term applied to them.