Tuesday, October 30, 2018

Image-based lighting in EB GUIDE

Thomas Engelhardt

Thomas Engelhardt, is a 3D expert at EB.

Figure 1 Left: A teapot with a ceramic PBR GGX material lit by three-point-light sources. Center: Using image-based lighting (IBL), the teapot is lit by a virtual environment and the ceramic PBR GGX material appears realistic. Right: Additionally, we can use textures to spatially vary the material parameters. This enables modelling surface variations of varying degree to achieve far more interesting looks.

As one of the key features in EB GUIDE 6.6 we introduced physically based material models for our 3D scene graphs. Physically based materials look highly realistic, because they compute the amount of light reflected at an object’s surface in an energy conserving and physically correct manner. However, materials are only one part of the equation—light sources are the other essential ingredient. Our three analytical light sources (point light, directional light, and spot light) use simple mathematical formulas that allow us to compute the illumination efficiently and physically correct. Unfortunately, this is not sufficient in all situations as you can observe from Figure 1 left. In real-world scenarios light arrives from virtually any point in the object’s environment of which analytical light sources are only an approximation.

With EB GUIDE 6.7 we now introduce image-based lighting (IBL) that allows us to use a high dynamic range (HDR) image of the environment and use it as a light source. This dramatically improves the visual fidelity of the rendered image as shown in Figure 1 center. The material of the object in Figure 1 center is perfectly uniform. This situation is rarely encountered in real world scenarios where the reflectance properties of objects vary spatially. To a degree this is already possible with EB GUIDE using various material textures like diffuse or specular textures. With EB GUIDE 6.7 we now add the possibility to control the roughness, shininess, and metallic properties using grayscale textures. This enables you to create objects that have a rusty, gritty, or scratched look as shown in Figure 1, right hand.

Using IBL in EB GUIDE

In the following we will show you how to get started with IBL in EB GUIDE. First, you require a high dynamic range image of an environment. For that you can use an HDR camera and take pictures of a reflective mirror ball (Debevec, HDRI and Image-Based Lighting, 2003), you can use procedural algorithms to create skylight images (Preetham, Shirley, & Smits, 1999) or you can use an image editing software to create such images manually, to name just a few examples. For this article we use examples found in the light probe gallery (Debevec, Light Probe Image Gallery, 2004).

Images of the environment are stored in special layouts, also called parameterizations, of which we can handle three as shown in Figure 2. (1) The so-called cube parameterization projects the environment onto a cube which is then unfolded into the 2D plane and stored in an image. (2) The sphere parameterization is essentially an image of a mirror ball in which the entire environment is reflected and (3) by unwrapping a sphere into the 2D plane we obtain the latitude-longitude parameterization.

Figure 2: Left: The cube parameterization projects the environment onto a cube and unfolds it into the 2D plane. Center: The sphere parameterization displays the reflection of the environment in a mirror ball. Right: The environment is projected onto a sphere which is then unwrapped into the 2D plane. Image courtesy of Paul Debevec (http://www.pauldebevec.com/Probes/)

Before we can use such an image for IBL in EB GUIDE, we need to transform it into a format that can easily be utilized by the GPU for lighting at runtime. This requires pre-processing for which we provide the so-called IBLGenerator command line tool. You will find that tool in the EB GUIDE installation folder, for example:

C:\Program Files (x86)\Elektrobit\EB GUIDE 6.7\tools\IBLGenerator\IBLGenerator.exe.

Invoking the tool on the command line with the -h option shows you all the parameters the tools accepts as shown in Figure 3.

Figure 3: The IBLGenerator tool comes with an integrated on-line help that shows the required and optional parameters as well as their meaning.

As you can see, the tool allows you to select different levels of processing quality. We recommend using lower quality levels (1-3) for generating previews and higher levels once satisfied with the result. In many cases a quality level of 5 will be sufficient.

To follow along in our example, download the Eucalyptus Grove angular map from the Light Probe Image Gallery (Debevec, Light Probe Image Gallery, 2004) in PFM format.
Use the command

/> IBLGenerator -i rnl_probe.pfm -o rnl_probe_q3.ebibl -q 3 -p sphere

to generate a so-called .ebibl file and copy into the resources folder of a newly created EB GUIDE project. Download the teapot.fbx and import it into a scene graph widget. After replacing the imported material with the PBR Phong material, the result should be as shown in Figure 4.

Figure 4: The teapot after the imported material has been replaced with a PBR Phong material. The ambient and emissive colors of the PBR Phong material are set to black.

Remove the existing nodes labeled “Omni001”, “Omni002”, and “Omni003” which contain analytical point light sources. Add an “Image-based light” widget to the scene graph instead and select the .ebibl-file that you generated earlier from the IBL property drop down list as shown in Figure 5.

Figure 5: Open the IBL widget properties panel by double-clicking on the image-based light in your scene graph. Then select the .ebibl file that was generated earlier from the IBL property dropdown list.

Then configure the material properties to your liking! Because IBL sources contain HDR content, the rendered image might look too bright and oversaturated. We recommend switching on the tone mapping widget feature of the scene graph widget.

With the IBL source and the material settings shown in Figure 6, the teapot looks like copper. The surface looks uniform and smooth. To make the surface more interesting, e.g. making it look weathered, we will use a grayscale texture to modulate the PBR Phong material’s shininess and metallic properties in the following.

Figure 6: Scene graph using the Eucalyptus Grove angular map as image-based light. For diffuse and specular color, we use an RGB color of (205, 133, 63) and set metallic as well as shininess to 0.8.

Using textures to modulate shininess and metallic material properties

Continuing with the previous example: Download the clouds.png and copy it to the resources folder of your EB GUIDE project. Next add the “Metallic texture” and “Shininess texture” widget properties to your PBR Phong material. Select the clouds.png in the “metallicTexture” and “shininessTexture” properties. Then the image should look as shown in Figure 7.

Figure 7:(1) Double-click the PBR Phong material widget to open the widget’s property panel. Then click on the “Add/Remove” button and select the “Shininess texture” and “Metallic texture” from the list. Select the clouds.png from the “shininessTexture” and “metallicTexture” drop down lists. This causes the texture to modulate the shininess and metallic properties of the material, rendering it partially weathered.

We hope you try the new IBL widget to generate stunning images for your HMI.

References

Debevec, P. (2003, July 28). HDRI and Image-Based Lighting. Retrieved from Paul Debevec: http://www.pauldebevec.com/IBL2003/

Debevec, P. (2004, 09 10). Light Probe Image Gallery. Retrieved from Paul Debevec: http://www.pauldebevec.com/Probes/

Preetham, A., Shirley, P., & Smits, B. (1999). A Practical Analytic Model for Daylight. Proceedings of the 26th Annual Conference on Computer Graphics and Interactive Techniques, (pp. 91–100).

Start modeling now!

As always, we are constantly looking for ways to improve the tool.

Download the latest version of the tool, try it out, and send us your feedback.

Also, do not forget to visit our Resources section to download examples, review tutorials, and read user documentation.

As always, get in touch with us if you have questions or feedback.