Вы находитесь на странице: 1из 3

Rendering image-plus-depth with blender

Quick manual, 19.Noe.2009, by Atanas Boev

1. Getting blender.
You can get Blender from blener.org, more specifically from here:
http://www.blender.org/download/get-blender/ For Windows (especially for Vista) I would
recommend Blender portable from portableapps.com, current version is here:
http://portableapps.com/node/2958 . Blender installation has some issues with Vista UAC, but the
portable version is known to work.

2. Rendering scene
Create your scene. You are allowed to use 3D models from the web, but the scene should be your
own. You can have one-two 3D objects against a textured (non-uniform colour) background, or
alternatively, 4-5 3D objects at different depths. The scene does not need to be artistic, but should
me more complex that one lonely 3D cube in the middle. How to create 3D scene is beyond the
scope of this manual, but you can find everything here:

http://wiki.blender.org/index.php/Doc:Manual

3. Rendering depthmap
Currently, the easiest option is to use z-value socket (the “z-utils” plugin des not work anymore).
First, switch to node editor:
Then, you should create a processing chain as shown here:

1. switch to “Composite nodes” (a) and select “use nodes” (b).


2. Add “render layers” source (1). Right click on the background, add->input->Render layers.
This will take values for the scene you have prepared.
3. Add a “map value” block, and connect it to the z-socket of “render layers”.
4. Now, you need to select the proper values for the “map value” block (3). What the block
does, is to map values in the range “offs” to “size” to values in the new range “min” to
“max”. It is a linear mapping. You need to map the depth values of your scene to the range
of 0..255 required for the depth map. Good starting values are: offs: 0, Size: 0.05, min:0,
max: 255. Later, you might need to change the “size” (and maybe “offs”) value to get a good
range of the depth map. Depth map with good range is one that has all values from 0 to 255
present and has nice, gradual shades of gray.
5. Add a “ColorRamp” block. We will use this block to invert the depth map. The map value will
output values between 0 (for near) and 255 (for far). For the depth map we need the
opposite – 0 for far, 255 for near. So we use the ColorRamp block to map the values 0..255
to a shades of gray starting from white and ending with black. When you put the
ColourRamp block, it is initially gradient from black to white. To invert that you chould
delete all gradient points (click the “del” button of the block couple of times) and add one
white point in the beginning, and one black point at the end. You can select the colour from
the top-left square. You add points with the “add” button. You select position of the points
by dragging across the gradient bar.
6. Add a “viewer” block and connect it to the “image” output of the ColorRamp block. This will
show you the output of your processing chain. Everytime you click the “render” button (2)
on the “render layers” block, the rendering will be repeated, and the processing chain will be
executed again. Now you should adjust the values in the “map value” block (3) to get good
depth map.
7. Add a “file output” block, and also connect it to the “image” output of the ColorRamp block.
Select BMP output and a temporary directory of your choice (5). Now each time you click the
“render” button (2) one image will be written to your directory. Blender creates incremental
file names, like “file1.bmp” “file2.bmp” and so on.
8. To get the rendered image, you can either render it form the initial window (before you
switch to “node editor”), or also could add another “file output” block and connect it to the
image socket in “rendered layers” block. In the second case, every time you click on the
“Render” button two files would be written to the disk, one with hte image, another with
the depth map (don’t forget to set different folders for both “file output” blocks).
9. Now, concatenate both bmp files (image and depth map) into one big BMP. The image part
should be 960x540px, and the depth map should be 960x540px. The big image should be
1920x540px and in BMP format.
10. Change the extension of your homework.bmp to homework.bmp.s3d. That is all.

Вам также может понравиться