imagico.de
imagico.de

imagico.de

MechSim

previous: Sim-POV Documentation - part 4 current: Sim-POV Documentation - part 5 next: Sim-POV Documentation - part 6 Navigation

Radiosity improvements

There are several improvements i added to the POV-Ray radiosity function some time ago. Sim-POV includes these patches. This is their documentation.

I these new functions offer a more detailed control of various radiosity parameters. Some allow to specify things previously hardwired in the source code. All of these functions were not tested very detailed yet.

I posted examples and explanation about some of these patches on the povray.org newsserver:

Subject: Re: Error_Bound Suggestion
Date: Fri, 30 Aug 2002 17:19:55 +0200
Newsgroups: povray.general
From: Christoph Hormann <chris_hormann@gmx.de>
news://news.povray.org/3D6F8D1B.24EB0982@gmx.de
http://news.povray.org/3D6F8D1B.24EB0982@gmx.de
Subject: Variable radiosity parameters test (~220k)
Date: Sun, 01 Sep 2002 18:42:44 +0200
Newsgroups: povray.binaries.images
From: Christoph Hormann <chris_hormann@gmx.de>
news://news.povray.org/3D724384.B9BF687F@gmx.de
http://news.povray.org/3D724384.B9BF687F@gmx.de
Subject: variable/adaptive radiosity count
Date: Thu, 05 Sep 2002 16:26:59 +0200
Newsgroups: povray.unofficial.patches
From: Christoph Hormann <chris_hormann@gmx.de>
news://news.povray.org/3D7769B3.15949030@gmx.de
http://news.povray.org/3D7769B3.15949030@gmx.de

New radiosity syntax description

Here is the new syntax description including all patches:

    global_settings { radiosity { [RADIOSITY_ITEMS...] } }

RADIOSITY_ITEMS:
    pretrace_end Float | pretrace_start Float |
    adc_bailout Float | always_sample Bool | brightness Float |
    gray_threshold Float | low_error_factor Float | max_sample Float |
    minimum_reuse Float | nearest_count Integer |
    recursion_limit Integer |
    media Bool | normal Bool |
    save_file Filename | load_file Filename |
    count { RAD_FLOAT_FUNCTION [, Float] [threshold Float] } |
    error_bound RAD_FLOAT_FUNCTION |
    cache_threshold Float |
    method Integer

RAD_FLOAT_FUNCTION:
    Float_Function | Float

Description of the individual patches

The improved radiosity consists of several independent patches which are described in the following paragraphs.

Every pictures shown has a link to a larger version and the render time in seconds is given.

Apart from the differences mentioned in the text the radiosity settings for the pictures are:

radiosity {
  pretrace_start 1
  pretrace_end 0.01
  error_bound 0.4
  count 120
  recursion_limit 2
}

Function based count and error_bound

This patch allows to use user defined functions instead of fixed values for the count and error_bound parameters. With these different values can be used for different parts of the scene.

Designing the function is quite easy because the object pattern can be used. The select() function in the following code switches between the two count values s#depending on whether a point is inside or outside the object.

#declare FnShape=
function {
  pattern {
    object { ... }
  }
}

#declare FnCount=function(xyz{ select(FnShape(xyz)-0.560240}

The following pictures show how increasing count in critical areas can increase quality and at the same time keep the render time fairly low.

fixed count 60 (208 sec) var. count 60/240 (280 sec) fixed count 120 (422 sec)
fixed count 60 (208 sec) variable count 60/240 (280 sec) fixed count 120 (422 sec)
var. count 120/360 (496 sec) fixed count 240 (>800 sec) increased count areas
variable count 120/360 (496 sec) fixed count 240 (>800 sec) increased count areas

Also error_bound can be varied with a function but this feature is extremely experimental, it will be likely to lead to unexpected results and is subject to future modifications. It currently will only vary the error_bound when taking new samples, not when reusing them.

var. e.b. 0.4/0.2 (362 sec) fixed e.b. 0.4 (435 sec) error_bound areas
variable e.b. 0.4/0.2 (362 sec) fixed e.b. 0.4 (435 sec) error_bound areas

Adaptive count patch

When taking a new radiosity sample POV-Ray 3.5 always shoots the same number of rays (specified with count). This patch allows to specify two count values: a minimum and a maximum. After Min_Count rays are shot the program analyzes the intersection points and decides from the distances to the sample's location whether to stop or to shoot all Max_Count rays. A threshold parameter specifies the threshold ratio for the minimum and maximum distance of the intersection points. If this ratio is larger than the threshold value, only Min_Count rays are shot.

If the threshold value is 1 all samples shoot Max_Count rays. With threshold 0 no sample shoots more than Min_Count rays.

The syntax for specifying these parameters is:

count {
  Max_Count, Min_Count
  threshold Float
}
count 120 (435 sec) adaptive 120/240 threshold 0.15 (783 sec) count 240 (916 sec)
count 120 (435 sec) adaptive 120/240 threshold 0.15 (783 sec) count 240 (916 sec)

Combined with the function based count Max_Count can also be a function.

Cache threshold patch

Normally nearly all radiosity samples taken are saved in an octree structure for later reuse. In POV-Ray 3.5 there is a fixed very low (0.0001) threshold triggering whether samples are stored or not. If the mean distance of the rays shot for that sample is below this threshold the chances this sample could be reused later are considered as too low and it is not saved. This patch allows to specify this threshold value.

Method patch

This patch is just an experiment, there is not necessarily any use of this new selection possibility.

In the original radiosity code of POV-Ray there are several methods for calculating the weights of the samples when they are reused. One method is actually used while the others are commented out. This patch allows to select the method to use in the scene file.

The method is an integer number, the following values are allowed:

The following pictures show the results with the different methods using the standard settings of the sample scene.

1 (RADIOSITY_SAW_METHOD1) 2 (RADIOSITY_SAW_METHOD2)
1 (RADIOSITY_SAW_METHOD1) 2 (RADIOSITY_SAW_METHOD2)
3 (RADIOSITY_SAW_METHOD3) 4 (RADIOSITY_SIGMOID_METHOD)
3 (RADIOSITY_SAW_METHOD3) 4 (RADIOSITY_SIGMOID_METHOD)