From BlenderWiki

Jump to: navigation, search

Introduction

Let's do a more advanced exercise, at least in Blender terms. Conceptually it is simple than it looks, we will just light some object with a small set of lights. Instead of focusing in the final result, we will focus in the method used in Blender. The basic precondition is to place lights in different layers, as demostrated by the provided blend file.

Basic Node Concepts

The node area header

A nodes setup is a graph, like flow charts, where the things passed around are pixels, vectors and numbers (we could say all those are numbers or groups of them, organized in different ways). So let's see the items we will need for our graph and at the same time explain the principles.

Before going with the nodes, note that you will have to enable Do Composite in F10 and open a Node area, where you will select the face looking icon and the Use Nodes button. That way we are ready to build our node setup and be sure it will render. Space is used like in 3D areas, to add, adjust, etc the nodes, and you can also use ⇧ ShiftD to duplicate nodes, G to move them around.


Mix Nodes

Mix node.

First node we are going to see is the Mix one, in Add / Color. It would allow us to see the basic controls of a node too. Nodes look like windows, with a title bar, some controls inside and circles at the sides. Those circles are the inputs, left side ones, and outputs, right side ones. The colour of the circle indicates what kind of data it expects or generates. Do not worry, there are ways to convert if needed.

Input and output, that indicates us that the data will pass from left side to right side, and the node will do something with it in the middle (otherwise it would be a waste).

Mix nodes are rather simple to describe: they accept two images and one value, and generate another image. Inside we have mix operation and value control. So the to images that are read from the left inputs are combined as described by the selector using the factor of the value control (or the value input if we plug something there).

In the title we see, from left to right:

  • The collapse triangle, like in Blender's panels
  • The name of the node
  • The show/hide toggle of unused connectors
  • The show/hide toggle internal controls

Some nodes also have a ball at the top left, which we can use to show/hide the preview (see next one).


Compositor

Compositor node.

Second node that matters is the one in charge of finishing, so to speak, the chain. It is a node that only has connections in the left side, so it will be a dead end for data. Its purpose is to show us the result and make it also avaliable to the render window or image areas. You can find it under Add / Output.



Render Layers

Render layer node.
Render layers panel.

Third and a bit more complex, the other extreme of the chain. It is a pure source, it only has outputs. You can find it under Add / Input. Internally it has a preview and a Render Layer selector.

To make sense of it, we need to go to F10, the Render Layers panel. Here is were we will create the Render layers we will use in in the nodes. They are just subsets of layer and data types to calculate.

We mark in the top layer buttons the layers we want to render, they follow the linked selectors in the 3D views. Next we have a name selector to add new layers or rename them, with its X to delete too.

Next there are another layer buttons, these will enable the layers for the selected layer, so we will enable only that are interesting in each case. Below you will find what type of things you want to see, like Halo or Solid faces, and what calculations are needed in each case, defaults are fine for our experiment, but say you want to do vector based motion blur, then you would enable Vec. In the future there should be buttons to toggle on and off specular, diffuse and other data. This is what you have probably heard as Render Passes. Currently you will have to do so by duplicating lamps and setting them to only affect specular or diffuse, for example.



RGB

RGB node.

This last one we will use in our setup is another generator. In the menu it is placed under Add / Input. In it we just select a colour by clicking. Simple node, but vital for our exercise.


Building the Network

Advice

Try to organize your nodes so they do not overlap or have connections crossing over others or below them. The readability of the network will speed up your workflow.

We add nodes via Space menu and move them around with G. To connect them, we drag from inputs to outputs, or viceversa. If you click in the background and drag, you get an eraser tool that will remove connections (this part breaks traditional Blender behaviour, so pay attention and do not hesitate to use Undo via CtrlZ).



Add

Just adding lamps.

Conceptually we want to combine multiple lamps into a final image. That means we need a Composite node, multiple Render Layers with their corresponding nodes and a way to combine them. We are talking about lights, adding the effects of multiple lamps... so the logical solution is to add them. This is achieved by Mix nodes set to Add and Factor to 1.0. Nodes only allow to add two image each time, but if you remember school ( 1 + ( 2 + 3 ) ) = 6 = ( ( 1 + 2 ) + 3 ), so that is what we will do, add them in pairs, the order does not matter.

All lamps added.



Multiply

Final setup.

We have a problem, the lamps add to a rather white image. Well, we left them at Energy 1.0 for this reason. So we are going to multiply each by a colour, so if we multiply by white, we keep the full intensity, but if we multiply by 50% grey, we keep only half of the result. And what is more, we can multiply by red or any other colour we please. You can see what happens when we select different greys in the RGB nodes:

Image with intensities adjusted.


Results

Image with colours adjusted.

So we got a more complex method to setup lights, but one that allows faster tweaking of colours and intensities, for example to get a warm late evening look. Placing the lamps in the right spot is still like in the plain method. If we take into account other reasons, like also applying depth of field effect or bloom effect, it quickly becomes worth the effort.

The point would be more that if we are going to use compositing anyway, we should take some time and split lights if they would help later. Once Blender gets separate passes for specular, diffuse, etc, you can be sure it will be a great thing to do, without doubt.