The global_settings statement holds the parameters that apply to the whole scene: how far rays are followed, the colour of ambient light, the working gamma, the global lighting methods (radiosity, photons, subsurface scattering) and a few constants of patterns. It may stand anywhere in the scene as long as it is not inside another statement, and a scene may have several. Each item is optional, the items may come in any order, and a repeated item replaces the earlier value (with one exception: assumed_gamma, see below). The settings that choose how an image is written (size, quality, anti-aliasing) are options of the program and are on INI options and switches.
Syntax
global_settings {
adc_bailout Float
ambient_light Colour
assumed_gamma Float | srgb | bt709 | bt2020
charset ascii | utf8 | sys
hf_gray_16 [Bool]
irid_wavelength Colour
max_intersections Integer
max_trace_level Integer
mm_per_unit Float
noise_generator 1 | 2 | 3
number_of_waves Integer
radiosity { radiosity items }
photons { photon items }
subsurface { subsurface items }
}
The parser reads the items until it meets a word that is not one of these; that word must then be the closing brace, or the scene stops with an error. The word for photons is photons (the manual's syntax line writes photon; the parser has only photons).
Items
| Item | Value | Default | Meaning and checks |
|---|---|---|---|
adc_bailout | float | 1/255 (0.0039) | Adaptive depth control. A reflected or refracted ray carries a weight that falls with every bounce; when the weight is below this value the ray is not followed. 0 turns it off, so only max_trace_level limits the recursion. |
ambient_light | colour | <1, 1, 1> | The colour of the ambient light. A surface's ambient term is its finish ambient multiplied by this colour. Only the rgb part is used. |
assumed_gamma | float, srgb, bt709 or bt2020 | 1.0 for a 3.7 or later scene without it (the parser warns); gamma handling off for an older scene | The gamma that the colours of the scene are written for, and the space in which all colour arithmetic happens. Only 1.0 (linear) gives physically correct mixing; other values are for compatibility. A value of 0 or below is an error, a value below 1 gets a warning ("did you mean 1/value?"). The first assumed_gamma wins: a second one gives the warning "New instance of assumed_gamma ignored". From version 3.7 a missing assumed_gamma is reported, and future versions may make it an error; write assumed_gamma 1.0 in every new scene. |
charset | ascii, utf8 or sys | unspecified | Still read, but the parser warns that it is no longer supported. It only changes how the text of a text object is mapped to glyphs in a scene below 3.8 (File types and structure). |
hf_gray_16 | optional bool | none | Read and ignored, with a warning. Use Grayscale_Output or +FNg for grey-scale height field output. |
irid_wavelength | colour | <0.70, 0.52, 0.48> | The relative wavelengths of red, green and blue light for the iridescence calculation. Filter and transmit parts are ignored. The numbers are proportional to wavelength and have no unit. (The defaults table of the manual lists <0.25, 0.18, 0.14>; the source and the text of the manual agree on 0.70, 0.52, 0.48.) |
max_intersections | number | none | Read and ignored. A scene of version 3.7 or later gets a warning that it has no effect any more. |
max_trace_level | integer | 5 | The deepest recursion for reflected, refracted and shadow rays. A value below 1 becomes 1; a value above 256 is cut to 256 with a warning. When a ray reaches the limit before it finds a surface that does not reflect, its colour is black. The manual adds that a render that reaches the default limit without one being set gives a warning. The word also works outside global_settings but a 3.5 or later scene is warned. |
mm_per_unit | float | 10 | How many millimetres one scene unit is. Only subsurface light transport uses it (10 means 1 cm per unit; 25.4 one inch; 1000 one metre). |
noise_generator | 1, 2 or 3 | 2 (1 for a scene below 3.5) | 1 is the original noise, which shows plateaus; 2 is the same noise with its range corrected; 3 is Perlin noise. Any other number is an error. A pigment, normal or warp can choose its own generator with noise_generator inside it. |
number_of_waves | integer | 10 | How many waves the waves and ripples patterns sum. A value of 0 or below becomes 1 with a warning. |
radiosity | block | off | Turns on diffuse inter-reflection (below). The block itself turns it on, even when empty. |
photons | block | off | Turns on photon mapping (below). |
subsurface | block | off | Turns on subsurface light transport, even when empty (below). |
#version 3.8;
global_settings {
assumed_gamma 1.0
adc_bailout 0.01
ambient_light rgb <0.8, 0.8, 1>
irid_wavelength rgb <0.7, 0.52, 0.48>
max_trace_level 12
mm_per_unit 10
noise_generator 3
number_of_waves 5
}
camera { location <0, 1, -4> look_at 0 }
light_source { <5, 8, -6> rgb 1 }
plane { y, -1
pigment { wrinkles scale 0.3 }
normal { waves 0.3 }
finish { ambient 0.1 }
}
sphere { 0, 1 pigment { rgb <1, 0.4, 0.2> } finish { ambient 0.1 } }
global_settings in one block. The noise generator and the wave count change the look of the wrinkles pigment and the waves normal.Radiosity
Radiosity replaces the constant ambient term by a light level computed from the surfaces around a point. The program shoots rays into the hemisphere above a point, averages what they see (using the diffuse colour of what they hit), stores the result as a sample and reuses it for nearby points. A first pass (the pretrace) works over the image in a mosaic of blocks that grow finer, so that the final pass finds most of the samples it needs. The settings trade quality against speed.
- Radiosity runs only when the quality level is 9 or more (
+Q9, the default). - In a scene of version 3.7 or later, a surface that gets radiosity has its finish
ambientignored. To make a surface glow, useemissionin its finish. A scene of an older version keeps both. - A
radiosityblock in a scene below 3.5 only warns that the block now turns radiosity on. The radiosity of 3.7 and later cannot be switched back to the old method with#version. - The cache file is not named in the scene any more:
load_fileandsave_fileinsideradiosityare read and ignored, with a warning. UseRadiosity_From_File,Radiosity_To_FileandRadiosity_File_Name.
| Keyword | Value | Default | Meaning and checks |
|---|---|---|---|
adc_bailout | float > 0 | 0.01 | Adaptive depth control for radiosity rays. For scenes with bright emissive objects use 0.01 divided by the brightest emission. |
always_sample | bool | off | Off: the final pass uses only the samples of the pretrace and takes no new ones, which is faster and smoother. On: new samples may be taken in the final pass. |
brightness | float > 0 | 1.0 | A factor on the gathered light. Leave it at 1 and change surface and light values instead; lowering it is for compensating a low recursion_limit. |
brilliance | bool | off | Honour the finish brilliance of surfaces in the radiosity calculation. (Read by the parser; the manual does not list it.) |
count | integer > 0 [, integer] | 35, then 1600 | The number of rays shot for each new sample. The optional second number is the size of the pool of directions that the rays are drawn from (round robin); it must not be smaller than the first. The manual notes that a count above 1600 switches to a Halton sequence. Too low a count looks blotchy. |
error_bound | float > 0 | 1.8 | The fraction of error tolerated before a new sample is taken. Lower is more accurate and much slower, and needs a higher count. |
gray_threshold | float 0 to 1 | 0.0 | Mixes the gathered colour towards its grey value, which reduces colour bleeding (0.6 means 60 percent grey). It changes the saturation, not the brightness. |
low_error_factor | float > 0 | 0.5 | The factor by which error_bound is lowered during the pretrace passes, so that a few extra samples exist for the final pass. |
max_sample | float | -1 (no limit) | The brightest a sample may be; brighter samples are scaled down without a hue change. A value of 0 or below allows any brightness. |
maximum_reuse | float > 0 | 0.2 | Upper bound of the reuse distance of a sample. |
media | bool | off | Let media affect the radiosity estimate. |
minimum_reuse | float ≥ 0 | 0.015 | The smallest radius of reuse, as a fraction of the screen width. With maximum_reuse the pair is checked after parsing: if minimum_reuse is more than half of maximum_reuse and only one of them was set, the other one is moved (with a warning); if both were set a warning is given; if minimum_reuse is not below maximum_reuse it is an error. |
nearest_count | integer 1 to 20 [, integer] | 5, then 0 | The number of old samples blended into a new value. The optional second number turns on the adaptive pretrace: the pretrace stops working on an area when that many average samples per ray are present. It must be at least 0 and smaller than the first number. Below 4 the result gets patchy (useful for debugging). |
normal | bool | off | Let surface normals (bumps) affect the estimate. |
pretrace_start | float, above 0 up to 1 | 0.08 | Size of the first pretrace blocks as a fraction of the image. |
pretrace_end | float, above 0 up to 1 | 0.04 | Size of the last pretrace blocks. It must not be larger than pretrace_start (an error after parsing). |
recursion_limit | integer 1 to 20 | 2 | How many bounces of diffuse light are computed. Above 3 is seldom useful. |
subsurface | bool | off | Honour subsurface light transport in the radiosity rays. |
load_file, save_file | string | none | Ignored (see above). |
Two object-level words belong with radiosity: radiosity { importance Float } in an object (the fraction of its sample rays that are fully computed, above 0 up to 1) and no_radiosity (hides the object from radiosity rays). Both are covered under Object modifiers.
#version 3.8;
global_settings {
assumed_gamma 1.0
radiosity {
pretrace_start 0.08
pretrace_end 0.02
count 120
nearest_count 6
error_bound 0.5
recursion_limit 2
low_error_factor 0.8
minimum_reuse 0.015
brightness 1.0
always_sample off
}
}
camera { location <0, 1, -4> look_at 0 }
light_source { <5, 8, -6> rgb 1 }
plane { y, -1 pigment { rgb 0.8 } finish { ambient 0 } }
sphere { 0, 1 pigment { rgb <1, 0.4, 0.2> } finish { ambient 0 } }
The presets of rad_def.inc
The include file rad_def.inc declares eleven constants and a macro that expands to the keywords of a preset. Put #include "rad_def.inc" before global_settings and call the macro inside the radiosity block:
Rad_Settings(preset, normal, media)
The second and third parameters (on or off) become the normal and media keywords. Every preset sets gray_threshold 0, brightness 1.0 and adc_bailout 0.005, and the macro prints the name of the preset to the debug stream. The keywords you add after the macro override it.
| Constant (value) | pretrace_end | count | nearest_count | error_bound | recursion_limit | low_error_factor | minimum_reuse | Use |
|---|---|---|---|---|---|---|---|---|
Radiosity_Default (0) | no keywords: the defaults of the program | an empty block | ||||||
Radiosity_Debug (1) | 0.02 | 10 | 1 | 0.3 | 1 | 0.8 | 0.015 | fast and rough, so the sample borders can be seen |
Radiosity_Fast (2) | 0.02 | 80 | 5 | 0.4 | 1 | 0.9 | 0.025 | quick but decent |
Radiosity_Normal (3) | 0.01 | 200 | 7 | 0.3 | 1 | 0.75 | 0.017 | typical values |
Radiosity_2Bounce (4) | 0.01 | 200 | 7 | 0.3 | 2 | 0.75 | 0.017 | typical, with two bounces |
Radiosity_Final (5) | 0.004 | 800 | 9 | 0.2 | 1 | 0.7 | 0.01 | slow, high quality |
Radiosity_OutdoorLQ (6) | 0.01 | 80 | 4 | 0.6 | 1 | 0.8 | 0.015 | outdoor scene without light sources, fast |
Radiosity_OutdoorHQ (7) | 0.004 | 500 | 7 | 0.1 | 1 | 0.5 | 0.015 | the same, high quality and slow |
Radiosity_OutdoorLight (8) | 0.01 | 50 | 4 | 0.8 | 1 | 0.9 | 0.015 | outdoor scene with sunlight, for a general sky effect |
Radiosity_IndoorLQ (9) | 0.01 | 80 | 5 | 0.7 | 2 | 0.8 | 0.015 | indoor, fast |
Radiosity_IndoorHQ (10) | 0.004 | 400 | 8 | 0.15 | 3 | 0.5 | 0.015 | indoor, slower |
All presets except the first set pretrace_start 0.08. The file sets #version 3.5 while it is read and restores the version of the scene afterwards.
#version 3.8;
#include "rad_def.inc"
global_settings {
assumed_gamma 1.0
radiosity {
Rad_Settings(Radiosity_Normal, off, off)
always_sample off
recursion_limit 2
}
}
camera { location <0, 1, -4> look_at 0 }
light_source { <5, 8, -6> rgb 1 }
plane { y, -1 pigment { rgb 0.8 } finish { ambient 0 diffuse 0.8 } }
sphere { 0, 1 pigment { rgb <1, 0.4, 0.2> } finish { ambient 0 diffuse 0.8 } }
Radiosity_Normal preset, with recursion_limit raised to 2 after it.Photons
Photon mapping computes caustics. Before the image is traced the program shoots photons from the light sources at the objects that are marked as targets. Where a photon has passed through or bounced off such an object and then lands on a surface, it is stored. During the trace, the stored photons near a point are gathered to estimate the extra light. Photons run only at quality 9 or more. (The manual gives 6 or more for photons; the program's quality flags in coretypes.h turn them on at 9, and the parser's own warning says "quality is set to 8 or less".)
| Keyword | Value | Default | Meaning and checks |
|---|---|---|---|
count | integer | 0 | The approximate number of photons to shoot. Doubling it doubles the photons. The result differs a little from the request (photons that miss a target's bounding box, or split into a reflected and a refracted one). |
spacing | float | 1.0 | The approximate distance between photons on surfaces. Halving it gives four times as many surface photons and eight times as many media photons. Use either spacing or count. |
gather | min, max | 20, 100 | The least and most photons gathered at a point. A maximum of 0 turns photons off. The least must not be below 0 or above the maximum (errors). |
media | max steps [, factor] | 0 (off) | Store photons in media. The first number is the most photons deposited per ray in one stretch of media (it must not be negative); the optional factor (above 0, default 1.0) widens the spacing for media photons. |
jitter | float | 0.4 | The jitter of the light rays in the pre-processing step. |
max_trace_level | number | the scene's value | Trace level for the photon-tracing step. |
adc_bailout | float | the scene's value | ADC bailout for the photon-tracing step. |
save_file | string | none | Write the photon map to this file. A later load_file or save_file replaces the earlier one (the last one decides whether the map is loaded or saved). |
load_file | string | none | Read the photon map from the file; no photons are shot then. The file holds the surface and the media photons. |
autostop | float | 0.5 | Photons are shot in a spiral from the light towards the target's bounding box. Shooting normally continues until the whole box is covered. With autostop the program stops once a complete circle of the spiral misses the target, but only after the spiral has passed this fraction (0.0 to 1.0) of the bounding box and at least one photon has hit the object. 0 allows the earliest stop and works for objects with holes. If the light is inside the box, photons go in all directions. |
expand_thresholds | float, number | 0.2, 35 | The gather radius is widened when fewer than the minimum number of photons are found (not with media). The first value is the largest increase in estimated density that is accepted (0.2 means 20 percent; an expanded search that raises it more is discarded). The second is the count below which the expanded search is always used. Neither may be below 0. The manual lists the second default as 40; the parser sets 35. |
radius | up to four numbers | -1, 1, -1, 1 | The gather radius for surface photons, a multiplier for it, the radius for media photons, and a multiplier for that. A radius of 0 or less (or none) lets the program estimate it. A multiplier below 1 speeds up the render at some cost of quality. |
#version 3.8;
global_settings {
assumed_gamma 1.0
photons {
count 20000
gather 20, 100
autostop 0
jitter 0.4
}
}
camera { location <0, 1, -4> look_at 0 }
light_source { <5, 8, -6> rgb 1 }
plane { y, -1 pigment { rgb 0.8 } }
sphere { 0, 1
pigment { rgbf <1, 1, 1, 0.9> }
finish { reflection 0.05 }
interior { ior 1.3 }
photons { target reflection on refraction on collect off }
}
target; the sphere takes no photons on itself (collect off).Photon words outside global_settings
| Where | Block | Meaning |
|---|---|---|
| object | photons { target [Float] reflection Bool refraction Bool collect Bool pass_through [Bool] } | target makes the object a target; the optional number is a spacing multiplier for photons that hit it (default 1.0; a value of 0 or less is not a target). reflection and refraction say whether the object reflects or refracts photons (default off). collect off stops it from storing or gathering photons (default on). pass_through lets photons pass through it on their way to a target (an object with no_shadow is marked this way, and pass_through off undoes that). Photons are not shot at an object without target, however refraction is set. In a union, split_union off makes the program shoot at the whole object. |
light_source | photons { reflection Bool refraction Bool area_light } | Turn photons from one light on or off for reflection and refraction; area_light lets an area light shoot photons. |
| media | collect off | The media ignores photons. Photons are also never stored in non-scattering media. |
The same blocks are described with their objects on Object modifiers, Lights and Media and interior.
Subsurface
Subsurface light transport (translucent materials such as skin or wax) runs only when a subsurface block exists in global_settings, even an empty one, and only at quality 9 or more. A material then opts in with subsurface { translucency Colour } in its finish. This is an experimental feature; the render reports it as such.
| Keyword | Value | Default | Meaning |
|---|---|---|---|
samples | integer, integer | 50, 50 | The number of samples for the diffuse scattering and for the single scattering approximation. Raise them for quality, lower them for speed. |
radiosity | bool | off | Apply subsurface effects to incoming radiosity based diffuse light. |
The scale of the effect depends on mm_per_unit; any effect of a change of it can also be had by changing the translucency of the materials.
Light groups and global lights
A light_group is a union of light sources and objects whose lights illuminate only the objects of the group (and the scattering media in it). Inside the group, global_lights on makes the objects also receive the global lights; off (the default) keeps them to the group's own lights. Light groups nest and combine with CSG. They are covered on Lights. They are mentioned here because the global lights, radiosity and photons all work on the objects of a group like any others.
Not described
Known, not yet covered
- Reference: the exact interplay of
countandspacingwhen both are given was not traced through the photon code;autostopandexpand_thresholdsare described as the manual describes them. The effect of a count above 1600 for radiosity is taken from the manual and was not checked in the radiosity source.