Lessen‎ > ‎

Render met radiosity

Deze tutorial is helaas niet meer beschikbaar in het Nederlands.

Using ldraw_radiosity.Inc - Version 3.0 Beta - 6-12-2004
Using these files is on your own risk.
Full credits go to Jeroen de Haan who has been working on this for more than two years.

To render your models you will need a tool that can convert LDraw files to POV-Ray (L3P) or directly write POV files from LDraw (LDView or L3Lab) and ofcourse POV-Ray.



  • Download the the digitalbricks ldraw radiosity files here (ZIP file)

Creating directories

  • In the root of your harddisk you should create a directory called "cust_inc".
  • In the directory i.e. C:\Program Files\POV-Ray for Windows vX.Y\Insert Menu you should create a directory "ZZ - LDraw". (the ZZ only means that the folder will be shown at the end of the Insert Menu in POV-Ray)

Placing the files

  • Extract the ZIP-file and place the 2 text files (ZZ - LDRAW Radiosity v2.0.txt and radiosity floor.txt) in the ZZ - LDraw directory.
  • Place the 4 INC-files in the cust_inc directory.

Editing the POV-Ray Master INI-file

POV-Ray has to know where the files are, so you have to add a line to the POV-Ray Master INI-file:

Open POV-Ray. Choose "Edit master POVRAY.INI" from the Tools Menu. Now Notepad opens with the POVRAY.INI file. Scroll to the bottom of the file. Add the line "Library_Path=C:\cust_inc" (without the quotes) after the other lines starting with "Library_Path=...". Save the file, quit Notepad and quit POV-Ray.

Using The Files

Open a L3P generated POV-file. Go to the line after "#declare DIF = 0.4;" and place your cursor there. Point your mouse at the Insert Menu, choose the LDraw Submenu Item and then choose "LDraw radiosity v3.0". Some lines of text are added now add we will go through them step by step:

// radiosity on/off
// 0 = off [default]
// 1 = on
#declare LDRAW_RAD_SWITCH = 0;

Easy: yes or no radiosity. Radiosity off is default.

// radiosity level (works only when LDRAW_RAD_SWITCH = 1)
// LDRAW_RAD_LEVEL = 0; // Default
// LDRAW_RAD_LEVEL = 1; // Debug
// LDRAW_RAD_LEVEL = 2; // Fast [default]
// LDRAW_RAD_LEVEL = 3; // Normal
// LDRAW_RAD_LEVEL = 4; // 2Bounce
// LDRAW_RAD_LEVEL = 5; // Final
// LDRAW_RAD_LEVEL = 6; // OutdoorLQ;
// LDRAW_RAD_LEVEL = 7; // OutdoorHQ;
// LDRAW_RAD_LEVEL = 8; // OutdoorLight;
// LDRAW_RAD_LEVEL = 9; // IndoorLQ;
// LDRAW_RAD_LEVEL = 10; // IndoorHQ;
// LDRAW_RAD_LEVEL = 11; // Anton Raves' Radiosity settings;
// LDRAW_RAD_LEVEL = 12; // Nico Kaiser's Radiosity settings;
#declare LDRAW_RAD_LEVEL = 2;;

The LDraw radiosity files make use of POV-Rays own rad_def.inc file. Eleven types of radiosity are defined. Please have a look at this page to see the differences. Or open the rad_def.inc file in a text editor.
The settings are rather good AND fast. I use the Final setting a lot and it is much faster than the old radiosity files. Dunno the difference between the Indoor and Outdoor settings.

Two settings are added; Anton Raves' setting (which is fairly clean and fast) and Nico Kaiser's setting which is optimised for 2 pass rendering (see below).

// radiosity normal
// off [default]
// on
#declare LDRAW_RAD_NORMAL = off;

// radiosity media
// off [default]
// on
#declare LDRAW_RAD_MEDIA = off;

Radiosity normal means if a material has bumps, radiosity will take these in account. I am not sure but think this will slow down rendering a bit. See this page for more info on radiosity and normals.
Media is used to create dusty rooms or underwater. Media itself will slowdown rendering so expect very slow rendering with media and radiosity...

// max_trace_level
// 0 = off (will increase artifacts) [default]
// >0 (decrease artifacts but slows down rendering)
// start with 5 and increase when needed
// NOTE: when using Radiosity Level 11 MTL is always on and the value is 20
// NOTE: when using Radiosity Level 12 MTL is always on and the value is 25
#declare LDRAW_MTL = 0;

The max_trace_level (MTL) is a radiosity setting which you need when you have transparant objects in your scene. If you don't POV-Ray will render black spots around the transparant objects random artifacts. Read the (online) POV-Ray manual for more information. When set to 0 (default) the scene will render fast but you will notice black spots all over the place. You can use this setting for test renders. Radiosity setting 11 and 12 have there own MTL (see notes).

// Overall brightness (only works when radiosity is on)
// 1 = no increase of overall light [default]
// higher = more overall light
#declare LDRAW_BRIGHTNESS = 1;

// Gamma (only works when radiosity is on)
// 2.2 = POV-Ray default
// lower is lighter
#declare LDRAW_GAMMA = 2.2;

Brightness and gamma will change the overall lightness of your image. Brightness will make all colours whiter equaly while gamma only affects the midtones. Plus with gamma you also can make things darker. Best is to use gamma; 2.2 is default, 1.8 will brighten things up a lot. If you dont want to change (or don't have any) lights in your scene this does the job.

// Colour Library
// 0 = Standard L3P or LGEO colours
// 1 = Jeroen's Colour Library [default]
// 2 = Todd's Colour Library
#declare COLOUR_LIBRARY = 1;

This is rather important. Depending on using radiosity or not and using LGEO or not you should choose a library.
Option 0 (zero) supports LGEO but looks a bit flat.
Option 1 supports LGEO, looks good with radiosity but not all colors are defined (when a color is not defined the standard L3P/LGEO color will be used).
Option 2 can be used with LGEO parts and but looks good with radiosity (a bit washed out sans radiosity IMHO) and all LDraw colours are defined and look very good. Read more about Todd's colors here.

// variable reflection
// 0 = off [default]
// 1 = on
#declare LDRAW_VARIFLEX = 0;

Variable reflection means that on round objects (spheres and cylinders) the reflection on the front (where you face the object direct) reflection will be less than on the sides of the object. Slows rendering down as hell but is worth it if you want realism. (Works only when using color library 1).

// sky sphere
// 1 = white/blue [default]
// 2 = clouds
// 3 = white/grey
// 0 = own (no sky_sphere is placed, define your own)
#declare LDRAW_SKYSPHERE = 1;

Easy, choose for a white sky sphere, a simple cloudy sky or no sky sphere so you can insert one yourself. Option 3 is like option 1 but will create grey shadows instead of blueish ones.

// Index Of Refraction
// 1.52 = default ABS
#declare INDEXOFREFRACTION = 1.52;

Index of refraction is the amount of distorion of light through a transparant object. L3Ps IOR = 1.2 which is actually a bit too low, but IOR will have the most effect on LGEO parts and will only work when using color library 1.

// Rendering in 2 passes (only works when radiosity is on)
// 0 = 0ff [default]
// 1 = first pass
// 2 = second pass
#declare LDRAW2PASSRENDER = 0;

What you do is you do a first pass render on low resoluton without anti-aliasing and a second render on high resolution with anti-aliasing.

For example: you want a 800 x 600 pixel render. First you render on 400 x 300 pixel resolution without anti-alias. Note the the render will look a bit odd; transparant parts will look different, LGEO slopes will look like LDraw slopes and even if you have the logo on stud option on, the are not there! This is right and will all work when rendering in the second pass. Change the parameter to 2, set the resolution to 800 x 600 and render again (NOTE: make shure that you don't have the +C (continue render) in the POV-Ray command line but that it is set to -C!). You notice that POV-Ray skips the mosaic-render and starts right away. You also notice that the transparants and LGEO slopes will look right and the logo does appear on the studs!

The idea behind this is that you calculate all the radiosity information in the first render, things like bumps (LGEO slopes), transparancy, logo's and anti-aliasing aren't important here, what counts is colour. But you don't have to think about it either; the radiosity files will turn of the slope-bumps, the logo and some other options. All you have to do is to change the LDRAW2PASSRENDER-parameter and the resolution.

For power users: if you use camera blur and/or spotlights you can turn these option off in the first pass and turn them back on in the second pass.

All this is done to speed up rendering.

#include "ldraw_radiosity.inc"

This should be left alone. Else it won't work.
Jaco van der Molen,
28 feb. 2011 00:44