Tutorial 1: Your first scene & render - LuxRender Wiki

Tutorial 1: Your first scene & render

Personal tools

From LuxRender Wiki

Jump to: navigation, search

This first tutorial covers the basics of using luxblend and luxrender in Blender to build a simple scene with a lightsource and a some simple materials. It is intended for users who are new to physically based render engines in general.

Contents

Introduction

If this is NOT the first time you ever used an unbiased rendering engine, feel free to skip this part.

LuxRender is an unbiased renderer that handles the physical aspects of your scene. What does that mean? With some internal renderers, there is so much you have to take into consideration when lighting and setting up the materials in your scene. Lights and materials in 3D computer graphics are different from the ones in the real world. You can have lights in 3D scenes that do not cast shadows, or ones that cast really crisp shadows, which is mostly unrealistic. Also, materials in the 3D world are different from the real world materials. You can have materials in 3D that appear to be completely transparent and yet cast very dark shadows. You will also come across scenes in which reflective glossy materials are right beside other matte materials, and yet light does not bounce off of the glossy object to the matter object the way it does in the real world.

You start to see how much effort gets put into making scenes realistic. There is a term in lighting called "cheating". Cheating is when you put those little details that make your scene believable. Imagine a teapot in 3D space put near a red wall. In reality the wall would absorb all colors of white light and reflect only the color red. To fake that effect in 3D, you would need to and place a dim red light between the teapot and the wall. In reality, this red light is not supposed to be there but you had to "cheat" to get this realistic effect. This cheating, though works and not punishable, is not always a feasible solution especially when you have so many objects, because then you would have a lot of bouncing lights and your scene can quickly become cluttered.

LuxRender takes all that burden away. When set up properly, LuxRender allows you to set up light(s) and not bother with all these details. Because it pretty much resembles the real world by the use of algorithms, physical and mathematical formulas, when you use LuxRender, you would just place the light where it's supposed to be (at the top for instance) and render. LuxRender will then calculate how much light bounces off each wall; how much light passes through each transparent material, generally how objects react to each other. Of course, there are settings that you should be aware of before you render your scene, but the LuxRender team has done a great variety of presets that will make setting the renderer even easier.

Bear in mind that this luxury -like many other luxuries- has a cost. In this case, the costs consist of longer render times as LuxRender does more calculations than non-physically based renderers. Therefore, it may be good to keep your scene efficiently organised while you're testing your render so you can easily hide unnecessary objects and turn off unnecessary lights. Also, render with lower settings and lower resolution will help a lot in limiting the time required to make preview renderings.

This tutorial will get you started so you can play with more settings and probably take that old scene that you modeled and spent a couple of days lighting and material configuring, and have LuxRender do the work in a couple of minutes or hours (it could be days too if you wanted, but you get the idea).

Scene setup

We will start with a simple scene: make a plane, a camera and place 3 monkeys on it as shown in this screenshot:

Image:Lbtut_t1_1.jpg

Assign some materials with names as shown above to the different objects you've created. We will use these names during material assignment in LuxBlend later on.

You do not have to configure any material colours or other parameters in the blender material editor, all this will be done in the LuxBlend material editor instead.


Light

Next, we will add a luxrender area lightsource (mesh emitter).

These are not the same as blender area lights, in luxrender they are emitting objects. In this case we will add a mesh plane and position it above our monkeys:

Image:Lbtut_t1_2.jpg

Lux area lights emit light only in the direction of the surface normal, so we have to make sure the normal is pointing down in our scene, otherwise no light will fall on our objects:

Image:Lbtut_t1_3.jpg

Assign a material named 'light' in blender to it.

You can do this by either rotating the plane around, or flipping the normals in edit mode.

Now we will define our plane object to be an area light by using the "light" material in luxblend. Fire up your luxblend script in a blender window, go to the material editor tab, and while having your object selected in your 3D window, you should see luxblend recognize the name of your material which is 'light'.

Change the material type to "light" on the purple bar of the material editor:

Image:Lbtut_t1_4.jpg

By default the light will be a white coloured light. We do not need to adjust any intensities as lux's tonemapping system will automatically adjust to any light intensity in your scene.

Adjusting light intensity (with the 'gain' parameter) is only used to adjust relative intensities when using multiple lights in the same scene.


Materials

Now on to assigning materials.

During this tutorial we will be using a "substrate" material for our floor plane, a "matte" material for our left monkey, "plastic" for the middle monkey and "glass" for the right monkey.

Select the floor plane we created and choose the "substrate" material in the LuxBlend material editor.

The substrate material has 2 colour components, 1 for the diffuse colour and 1 for the specular/glossy colour.

Click on the little coloured box on the diffuse channel and select a dark brownish colour:

Image:Lbtut_t1_5.jpg

The specular component is usually (for most normal substrate materials) a grey colour with approximateley the same intensity as the diffuse colour.

Now do the same as above for the specular channel and select a dark grey colour:

Image:Lbtut_t1_6.jpg

The "substrate" material also has a roughness channel which allows us to define how glossy the surface will appear. We will have our floor appear medium to low glossy so set it to 0.0001:

Image:Lbtut_t1_7.jpg

Lux's roughness values can range from 1.0 (pure lambertian / very rough) to 0.00001 (nearly specular), with 0.001 being somewhere in the middle.

Next we will assign a "matte" (diffuse) blue coloured material to our left monkey.

"matte" materials are fairly simple and only have 1 channel for diffuse. They are rough and don't have/need any roughness parameter.

Select the monkey, and assign a "matte" material and give it a blue colour, similar to what you did before:

Image:Lbtut_t1_8.jpg

Next we will use a red "plastic" material on the middle monkey.

Do the same as above, selecting "plastic" as the material type, and choose a red colour for the diffuse channel:

Image:Lbtut_t1_9.jpg

You can leave the specular colour to pure white (the default) as that should match, as it's got approximateley the same intensity as pure red.

Next, we use an even less glossy appearance than our floor by setting the roughness value of our plastic material to 0.0001:

Image:Lbtut_t1_10.jpg

Our last monkey will be made out of glass.

The glass material is preconfigured by default to model a fused silica (normal glass), so just assign the glass material to it:

Image:Lbtut_t1_11.jpg


Previewing your render

At this point we will want to have a look at what our render will look like.

We will use a very fast, biased preview method for a quick look.

Although our scene is simple enough to preview it with full unbiased quality, we will use the directlighting preview here anyway to demonstrate the process, which will come in handy on more complex scenes later.

Select the render preset dropdown and choose 'Preview - Directlighting only':

Image:Lbtut_t1_12.jpg

The engine will now render without any indirect light, giving a traditional CG look to your scene, with no glossy reflections (only lights), but it will do it very fast.

Hit the Render button at the bottom of the exporter and you should have a pretty good preview in a couple of seconds:

Image:Lbtut_t1_13.jpg

NOTE: it usually takes 12 seconds for the GUI to update the image during rendering. If you want it faster, you can modify this interval (in seconds) in the 'Output' tab of the exporter.

Adding some subdivision

Adding some subdivision will make our monkeys look a lot nicer.

We can do this using a blender 'subsurf' modifier, or we can just export our simple meshes we have now and let lux subdivide them internally in the engine. The latter provides a much faster method to export geometry (especially when there it a lot of it, with large numbers of subdivisions)

To have lux subdivide your meshes, select a monkey and enable the subdivision button in the mesh options at the bottom of your material, and set the sublevel to 3:

Image:Lbtut_t1_14.jpg

Make sure the 'smooth' button is enabled to smooth the surface. Repeat this for the 2 other monkeys in our scene.

Final rendering

We will now render our final image.

Change the render configuration preset to 'Final - low MLT/Path Tracing (RECOMMENDED):

Image:Libtut_t1_20.png

This will change the configuration of the engine to use Metropolis Light Transport ontop of Path tracing. This will result in a full/unbiased render result.

Next, go to the 'output' tab in luxblend, and make sure the 'Tonemapped TGA' button is enabled:

Image:Libtut_t1_21.png

The engine will now save a tonemapped .tga image file every 120 seconds in the same directory as your export scene file is located. (This is the 'default out dir' which you configured before during the installation of luxblend in the 'system tab)

Hit the render button again and you will see the image appear after a few seconds. The image will slowly get better and better in quality, it will become less and less noisy. Once you are satisfied with the result, close LuxRender and you can use your .tga file which was saved.

The final result
The final result