Computer graphics Labs: Blender (2/3) LuxRender: …parameter ‘Focal Length’ in the tab...

17
Computer graphics Labs: Blender (2/3) LuxRender: Interior Scene Rendering University of Liège – Department of Aerospace and Mechanical engineering Designed with Blender 2.76b

Transcript of Computer graphics Labs: Blender (2/3) LuxRender: …parameter ‘Focal Length’ in the tab...

Page 1: Computer graphics Labs: Blender (2/3) LuxRender: …parameter ‘Focal Length’ in the tab ‘Lens’. 3. Creating a sun. o Select the Blender lamp that is present on the default

Computer graphics Labs: Blender (2/3) LuxRender: Interior Scene Rendering

University of Liège – Department of Aerospace and Mechanical engineering

Designed with Blender 2.76b

Page 2: Computer graphics Labs: Blender (2/3) LuxRender: …parameter ‘Focal Length’ in the tab ‘Lens’. 3. Creating a sun. o Select the Blender lamp that is present on the default

2

LuxRender During the first tutorial session, you have used Blender internal render engine. Besides this default engine, Blender allows the use of other render softwares. During this second tutorial, we will use one of these softwares: LuxRender. LuxRender is a software that allows getting very realistic images that takes into account, for instance, the global illumination and caustics.

Add-On LuxBlend Activation To use LuxRender in order to render a Blender scene, it is needed to activate an Add-On (LuxBlend). This Add-On allows defining materials according to the method used by LuxRender and generating the scene export as well as rendering options. The Add-On activation is to be carried out as following:

1. Get to the window ‘Blender User Preferences’ via the menu File->User Preferences… 2. In the horizontal bar located at the window top, select ‘Add-Ons’. 3. Then, switch to the category ‘Render’ and click the box ‘Render: LuxRender’ on the

right.

Once the Add-On is activated, LuxRender appears in the render engines list in the Blender menu bar. In this menu, select ‘LuxRender’ instead of ‘Blender Render’. The Blender interface is then automatically adapted to the use of ‘LuxRender’.

Page 3: Computer graphics Labs: Blender (2/3) LuxRender: …parameter ‘Focal Length’ in the tab ‘Lens’. 3. Creating a sun. o Select the Blender lamp that is present on the default

3

Scene Creation We will now use the default cube in order to create the room’s walls. Then, we will add a few objects inside the room.

Room positioning 1. Select the cube that is lying at the centre of the room. 2. Then, switch to the panel ‘Object’ from the properties window.

3. In the tab ‘Transform’, enter the following parameters:

Window creation 1. Using the selected cube, switch to the ‘Edit Mode’ [Tab]. 2. Subdividing the parallelepiped:

o Select all vertices [a] if not already done. o Click on ‘Subdivide’ in the lateral panel left to the visualisation window in the

tab ‘Add’. o Set the box ‘Number of Cuts’ to 2.

3. Adjusting the created vertices’ position: o We will now move the upper horizontal cut up in order to vertically increase

the window. o Use the profile view [3], switch to the orthogonal projection [5] and unselect

all vertices [a]. o Deactivate the mode ‘Limit Selection to Visible’ in the visualisation window

header.

Page 4: Computer graphics Labs: Blender (2/3) LuxRender: …parameter ‘Focal Length’ in the tab ‘Lens’. 3. Creating a sun. o Select the Blender lamp that is present on the default

4

o Select all vertices from the upper horizontal cut through using a box [b].

o If not visible, make the visualisation window’s properties panel appear by

clicking [n] or by clicking on the ‘+’, which is to be found in the right upper corner of the visualisation window.

o In the tab ‘Transform’ of the properties panel, first activate the ‘Global’ mode,

and then define the position to 8 according to the axis Z. 4. Window cutting

o Switch to ‘Face select mode’ in the visualisation window header.

o Select the central side by right-clicking in the centre of the said side.

o Deleted this side by clicking [x] and through choosing ‘Faces’ in the appearing

menu.

Defining Materials LuxRender has a material definition that is different from the one found on Blender. Activating LuxRender as a render engine modifies the materials definition interface. Nevertheless materials properties are still accessible thanks to the button ‘Material’ in the properties window.

Like the octopus eyes of the previous tutorial, we will assign two different materials to the parallelepiped. The first to the walls and the second to the floor.

1. Creation and assignation of both materials. o Activate the material properties window through clicking ‘Material’ in the

properties window.

Page 5: Computer graphics Labs: Blender (2/3) LuxRender: …parameter ‘Focal Length’ in the tab ‘Lens’. 3. Creating a sun. o Select the Blender lamp that is present on the default

5

o A first default material is already present. Change this material name for ‘Mur’ in order to make easier its identification for later.

o Add a second ‘Slot’ material to the object by clicking on ‘+’ (‘Add Material

Slot’) next to the slots list.

o Then select the created ‘Slot’ and click on ‘New’ under the list in order to

assign to it a new material. Name this material ‘Sol’. o Activate the ‘Edit Mode’ if inactive.

o In the profile or front view ([3] or [1]), select all faces of the parallelepiped basis using a box [b]. Assign to them the ‘Sol’ material by selecting this material in the slots list and by clicking on ‘Assign’ that is to be found underneath.

2. Defining a matte material for walls. o Select the material ‘Mur’ in the slots list. o Choose ‘matte’ as a ‘material type’ in the upper portion of the material

properties window. o Define a yellowish orange colour in the box ‘Diffuse color’ from the tab

‘LuxRender Matte Material’: R=0.65, G=0.4, B=0. 3. Defining a glossy material for the floor.

o Select the material ‘Sol’ and set type material to ‘Glossy’ in order to make the reflection specular.

o Keep the default diffuse colour. In order to get an even more spectacular reflection, brighten a little bit the specular colour (box ‘Specular Color’ below the tab ‘LuxRender Glossy Material’): R=0.15, G=0.15, B=0.15.

Creating thick Walls We will now use a ‘Modifier’ in order to make the walls thicker.

1. Switch to the ‘Object Mode’. 2. The parallelepiped being selected, activate the ‘Modifiers’ panel from the

properties window.

3. Click on ‘Add Modifier’

and select ‘Solidify’ in the column ‘Generate’.

4. Set ‘Thickness’ at 0.2 and ‘Offset’ at 1 for the extra thickness to be place outside the parallelepiped. Eventually check the box ‘Even Thickness’ for the thickness to be uniform.

Page 6: Computer graphics Labs: Blender (2/3) LuxRender: …parameter ‘Focal Length’ in the tab ‘Lens’. 3. Creating a sun. o Select the Blender lamp that is present on the default

6

Extra light source. For lightening the room, we will place a neon light source on the ceiling. This source will be created through using a parallelepiped whose one face will emit light.

1. Switch to wireframe display [z] to visualise the interior of the room. 2. To create the neon light source on the ceiling, add a cube to the scene:

Object Tools panel->Create->Cube. Then, switch to the ‘Object’ panel in the properties panel. Define position and dimensions of the neon as following in the tab ‘Transform’ in order to set it onto the ceiling.

3. In the tab “LuxRender Light Groups” of the “Render Layer” panel in the properties panel, clic “Add Lightgroup” and append a new group “Neon”. Also add a new group “Soleil”. This group will be used later on for simulating the sunlight.

4. In the panel ‘Material’ of the properties window, assign two materials to the object. The first one will be a matte grey material: R=0.5, G=0.5, B=0.5. The second one is used to create the light source.

o Assign this second material to the bottom face of the neon.

o Choose a matte material. o Activate the box situated above the tab

‘LuxRender Light Emission’ and scroll down this tab.

o In the box ‘Light Group’, enter ‘Neon’. o Choose a slight blue colour for ‘Emission Color’: R=0.8, G=0.8, B=1.

Page 7: Computer graphics Labs: Blender (2/3) LuxRender: …parameter ‘Focal Length’ in the tab ‘Lens’. 3. Creating a sun. o Select the Blender lamp that is present on the default

7

Reflecting elements 1. Mirror:

o Exit the ‘Edit Mode’ [Tab]. o Add a plane (Object Tools panel->Create->Plane) to the scene and put it as

following using the ‘Object’ panel of the properties window.

o Create a new material to be named ‘Miroir’ for instance. o Choose ‘Mirror’ as ‘Material type’ and keep the default properties.

2. Facets ball:

o The facets ball will be created using a UV sphere. Add this sphere (Object Tools panel->Create->UV Sphere) and put it n the floor as following:

o We will then assign the same material

that we have used for the mirror. To do so, go into material properties . Instead of creating a new material by clicking on ‘New’, click on ‘Browse Material to be linked’ that is to be found on the left, in order to scroll down the menu illustrated here. In the list, choose ‘Miroir’.

Cylinder 1. In order to finalise the scene, add a cylinder (Object Tools panel->Create->Cylinder)

and put it on the floor next to the facets ball:

Page 8: Computer graphics Labs: Blender (2/3) LuxRender: …parameter ‘Focal Length’ in the tab ‘Lens’. 3. Creating a sun. o Select the Blender lamp that is present on the default

8

2. For the cylinder to seem to be smooth, it is needed to apply to it a ‘Smooth Shading’ as we have seen during the previous tutorial. Note down that only vertical edges are to be smooth, whereas both circular edges need to remain sharp. It is thus impossible to apply ‘Smooth’ to the whole object as done previously.

o Switch to ‘Edit Mode’ [Tab]. o Unselect all faces [a]. o Using a box [b], select all vertical faces (in the front view, for instance). o Click ‘Smooth’ in the tab ‘Shading’ under ‘Faces’ in the left panel. Only

selected faces are smoothened. o Exit the ‘Edit Mode’.

3. We will now assign a transparent material to this object by using a volumetric definition of the material. Activate the panel ‘World’ in the properties window. The tab ‘LuxRender Volumes’ allows defining various types of volumetric materials.

o Click on ‘Add’ and name ‘Verre’ the new material. o Since glass usually does not or only slightly diffuse light, keep the parameter

‘Type’ at its default value (‘Clear’). o Choose the preset ‘Transparent->Glass, Pyrex’ for the refraction index. o Set the absorption colour at R=0.3, G=0.3, B=1. o Thanks to the volumetric definition, the colour of a light ray exiting the object

will depend on the thickness of the crossed material. The colour defined in the box ‘Absorption’ is reached when the crossed thickness equals the value of the fields ‘Abs. at depth’. The cylinder radius being of one unit, you may keep this box value set at 1.

4. Then, switch to the panel ‘Material’ . Create a new material and select ‘Glass 2’ as

‘Material type’ in the tab ‘LuxRender Material’. o In the box ‘Interior’, select the volume ‘Verre’ that you just have created.

Page 9: Computer graphics Labs: Blender (2/3) LuxRender: …parameter ‘Focal Length’ in the tab ‘Lens’. 3. Creating a sun. o Select the Blender lamp that is present on the default

9

Camera and Sun 1. Positioning the camera.

o For setting the camera inside the room, facing the mirror and for giving it a correct orientation, apply the following parameters.

2. Setting the camera.

o Using the selected camera, activate the panel ‘Object Data’ of the camera.

o For a larger portion of the scene to be visible to the render, adjust the

parameter ‘Focal Length’ in the tab ‘Lens’.

3. Creating a sun.

o Select the Blender lamp that is present on the default scene. o Activate the panel ‘Object Data’ in the properties window.

o Change the light source type into ‘Sun’ in the tab ‘LuxRender Lamps’ and

enter ‘Soleil’ as ‘Light Group’.

o Besides representing an infinitely-far light source, the Sun type of LuxRender

simulated as well light coming from the atmosphere. FYI, this default behaviour may be, if needed, deactivated in the tab ‘LuxRender Sun Lamp’.

4. Sun positioning. o It is wished that sun rays go through the window and light up the objects on the

floor. To do so, adjust the sun position and orientation as following:

Page 10: Computer graphics Labs: Blender (2/3) LuxRender: …parameter ‘Focal Length’ in the tab ‘Lens’. 3. Creating a sun. o Select the Blender lamp that is present on the default

10

Rapid Render without Global illumination Render setting

1. Activate the panel ‘Render’ in the properties window. This panel allows access to the render engine options. These options are displayed in several tabs.

2. The first tab, ‘Render’, consists of two buttons allowing the launch of an image or an animation render.

o Make sure as well that the box ‘Path to LuxRend’ is set: /opt/ComputerGraphics/ Lux-v1.5.1-x86_64-sse2-OpenCL

3. The tab ‘Dimensions’ allows adjusting the image dimensions as well as the start and end image in an animation.

o In the resolution group, set the image dimension at 25% in order to reduce the calculation time.

4. The tab ‘LuxRender Render Settings’ contains the main options of the render engine.

It allows access to various predefined render profiles in the menu ‘Render Engine Presets’.

o In order to get a fast preview of the scene without taking into account the global illumination, choose ‘Preview – Direct light’ in the menu. The other parameters from this tab, such as ‘Rendering Mode’, ‘Sampler’ and ‘Volume Integrator’ are automatically adjusted by the chosen profile.

5. The fields ‘Halt Samples’ and ‘Halt time’ allow define the render stop criterion. A null value means that the stop criterion is deactivated.

o Using ‘Halt Samples’ you may define a sample number per pixel to be reached. Once the threshold reached, the render will stop. This criterion has an impact on the render quality; the higher this threshold, the better the render.

o As indicated by its name, Halt time’ defines how many seconds are dedicated to the rendering of an image. Set this criterion at 30 seconds.

Page 11: Computer graphics Labs: Blender (2/3) LuxRender: …parameter ‘Focal Length’ in the tab ‘Lens’. 3. Creating a sun. o Select the Blender lamp that is present on the default

11

Render calculation To launch the render, it is enough to click on ‘Image’ in the tab ‘Render’ or to click [F12]. The Blender model is then exported to LuxRender and a new window opens, in which the result is updated every 10 seconds.

The status bar below the LuxRender window displays interesting statistics on the render progress.

• S/p gives the average samples number per pixel. • kS/s gives the number of samples processed every second. • Eff is the efficiency of the progressing render. A 250% efficiency means that each

sample, on average, carries 2.5 contributions to the scene light sources. An efficiency under 100% means that LuxRender has difficulties to find light sources and that some samples are useless, since they do not make light sources take part.

• kC/s is an alternative efficiency measure. Once the render is over, you may close the LuxRender window. Blender then retrieves the calculated image and displays it instead of the visualisation window. To get back to the visualisation window, click [Esc].

Using a ‘Portal’ The Render obtained after 30 seconds is still quite noisy and its efficiency is around 95%. This relatively low value is normal when indoor scenes such as this one are considered. Some light sources have indeed no direct path to the camera (the sun rays ought to get into the room through the opening of the front window before getting to the camera). There is, though, a way to inform LuxRender that allows linking the camera to the light sources. This technique is based on creating ‘Light Portals’.

1. Firstly, add a plane (Object Tools panel->Create->Plane). 2. Position it and scale it as following. The ‘Light Portal’ will be put in a way that

permits it to entirely cover the window opening.

Page 12: Computer graphics Labs: Blender (2/3) LuxRender: …parameter ‘Focal Length’ in the tab ‘Lens’. 3. Creating a sun. o Select the Blender lamp that is present on the default

12

3. At this stage, it is important to make sure that the plane is correctly directed to the inside of the room (facing the camera).

o To do so, switch to the ‘Edit Mode’ [Tab] and activate the lateral panel of the visualisation properties window [n].

o In this lateral panel, the tab ‘Mesh Display’ presents the rubric ‘Normals’. Set the box ‘Size’ at 1 to increase the normals representation.

o A cyan line then appears at the centre of the face. It is then needed to check

that it is correctly oriented (to the inside of the room). If not, click on ‘Flip Direction’ in the tab ‘Shading/UVs’ in the left lateral panel in order to invert the normal direction.

Eventually, it is still needed to tell LuxRender that the plane we just have created is a ‘Portal’. This is done through the panel ‘Object Data’ in the properties window (with the selected plane). At the bottom of this panel, in the tab ‘LuxRender Mesh Options’, is a box named ‘Exit Portal’. Check it for LuxRender to favour light rays crossing this plane.

Re-launch the render. The image obtained for the same calculation time is of better quality. This is visible as well in the value and efficiency that is higher to the previous value. The ‘Portal’ effect is even more important than when the global illumination is considered (see further).

Using ‘Light Groups’ When setting the scene, you have assigned a neon light emitter surface to the ‘Light Group’ Neon and a sun to the Sun Group. The usefulness of the ‘Light Groups’ lies in adapting intensity and even colour of each ‘Light Group’ without regard to the interior of LuxRender during and after rendering. This means it is possible, for example, to reduce the sun intensity without having to recalculate the whole image. To do so, go to the tab ‘Light Groups’ in the LuxRender application. You will find there the various controls for each of the groups:

Page 13: Computer graphics Labs: Blender (2/3) LuxRender: …parameter ‘Focal Length’ in the tab ‘Lens’. 3. Creating a sun. o Select the Blender lamp that is present on the default

13

• The cursor ‘Gain’ allows adjusting intensity. • The button allows completely switching off a group.

Volume effects The volumetric definition of materials has been already used previously for the cylinder. The same tools allow as well representing volumetric effects, such as diffusing or absorbing of light when crossing a partially transparent matter. It is thus possible to render the light diffused by the air.

1. Activate the panel World in the properties window. o In the tab ‘LuxRender Volumes’, click on ‘Add’ and name the new volume

‘Air’. o In order to obtain a volume diffusing light, choose ‘Homogeneous’ as ‘Type’. o Even though this is of little importance in this case, a right refraction index can

be obtained by choosing ‘Gases->Air’ in the menu above the box ‘IOR’.

o You may keep the white absorption colour. It is considered that the environment does not absorb light. This way, the light will not be impacted by the environment.

o For the diffusion (‘Scattering’) to remain moderated, set a dark colour (R=0.02, G=0.02, B=0.02). This colour can be interpreted as the colour of particles floating in the air and that diffuse light in all directions.

2. Then define ‘Air’ as the default outside environment in the tab ‘LuxRender World Settings’ in the panel ‘World’.

3. Launch the render. You should see diffused light

entering by the window.

Page 14: Computer graphics Labs: Blender (2/3) LuxRender: …parameter ‘Focal Length’ in the tab ‘Lens’. 3. Creating a sun. o Select the Blender lamp that is present on the default

14

Global Illumination Render

General Render Parameters 1. Activate the panel ‘Render’ in the properties window. Now go to the tab

‘LuxRender Render Settings’. In order to get a render with an global illumination, choose the preset ‘Default – Full Global Illumination’.

2. We now temporarily deactivate the air diffusion effect. To do so, select ‘Emission’ as

‘Volume Integrator’ in the tab ‘LuxRender Render Settings’. This way, the volume integrator will not take into account anymore volume emitters and absorption; the diffusion will not be calculated.

Rendering Mode The menu ‘Rendering mode’ in the tab ‘LuxRender Render Settings’, as well as options below, determine how LuxRender constructs paths linking light sources to the camera, and calculates light intensity reaching the camera. LuxRender proposed several render modes. The one selected by the profile is ‘Default – Full Global Illumination’: a bidirectional integrator allowing taking into account global illumination. It was the contrary with the ‘Direct Lighting’ algorithm that we have used to obtain the previous renders. Long story short, the bidirectional integrator generates light paths from two paths: the first one leaving from the camera and the second one from a light source, as illustrated by two continuous broken lines (figure here-below). After having generated a path in both directions, new paths have been created connecting, in any possible way, both initial paths (as indicated by the discontinued lines on the figure). The light ray intensity is calculated according to the materials met on the way and the reflection angles.

Page 15: Computer graphics Labs: Blender (2/3) LuxRender: …parameter ‘Focal Length’ in the tab ‘Lens’. 3. Creating a sun. o Select the Blender lamp that is present on the default

15

(Adapted from: E. Veach, Robust Monte Carlo methods for light transport simulation)

The maximum path length (considering the number of reflections) may be directly adjusted in the Blender interface. This is done through the tab ‘LuxRender Render Settings’ in the panel ‘Render’ in the properties window via the boxes:

• ‘Max Eye Depth’: number of dots of the path leaving the camera; start dot included. • ‘Max Light Depth’: number of dots of the

path leaving a light source; start dot included.

In order to illustrate the algorithm, we will modify the value of both parameters and observe the result on the render.

1. First of all, set ‘Max Eye Depth’ at 2 and ‘Max Light Depth’ at 1. Now we are in the case presented in the figure here-below. Only the direct lighting is taken into account. We thus get a similar result to the one obtained previously. Besides, since only one reflection by light track is allowed, mirrors remain black.

2. In order to improve the render, increase ‘Max Eye Depth’ to 3. As shows in the figure

below, by increasing the parameter, the maximum number of reflection per track is now 2. This allows a rendering of reflections on mirrors. One will notice, though, that the reflection of the sphere in the mirror still remains absent. It is needed to increase ‘Max Eye Depth’ by one extra unit to have a correct reflection.

Page 16: Computer graphics Labs: Blender (2/3) LuxRender: …parameter ‘Focal Length’ in the tab ‘Lens’. 3. Creating a sun. o Select the Blender lamp that is present on the default

16

Besides, indirect illumination effects begin to be visible: the right wall is not completely black anymore – it receives reflected light from the other walls and room’s objects.

However, it is still not possible to see through the cylinder. To do so, it is needed to increase ‘Max Eye Depth’ up to 4, since an extra surface needs to be lightened through.

3. Alternatively, invert values of both parameters. Set ‘Max Eye Depth’ at 1 and ‘Max Light Depth’ at 3. Following the decreased value of the parameter ‘Max Eye Depth’, the mirror surfaces are again black. Yet, with a greater ‘Max Light Depth’ value, the light reflection from the sun on the sphere facets generates light patches on the floor and the walls of the room.

Page 17: Computer graphics Labs: Blender (2/3) LuxRender: …parameter ‘Focal Length’ in the tab ‘Lens’. 3. Creating a sun. o Select the Blender lamp that is present on the default

17

Again, it is possible to see extra effects by increasing again the value of ‘Max Light Depth’. From the value 4, we may see, on the left of the cylinder, a light patch (caustic) resulting from the refraction of sun rays through the cylinder.

A correct rendering of the scene thus needs values that are enough high in both ‘Max Eye Depth’ and ‘Max Light Depth’. It is for this reason that the default value is 48 for both parameters.

Advices for using LuxRender • Colours:

In general, it is recommended to keep diffuse colour RGB components under 0.8. In the real world, no objects reflect 100% of the light. Besides, this will help LuxRender to converge more rapidly. Furthermore, specular colours should be below 0.25.

• Avoid specular surfaces whenever possible. • Limit mesh complexity. • When the defined volumes on the scene only slightly diffuse light (it is the case with

the air), it is enough to use the volumetric integrator ‘Single’. The ‘Multi’ version is heavier and is useful solely when encountering highly diffusive solids.

• Border rendering: In order to reduce calculation time, it is possible to restraint the render to only part of the image. To determine the part to be calculated, it is enough, in camera view [0], to click [shift-b] and to sketch with the mouse the sub-rectangle of the image that will be calculated.