Difference between revisions of "Documentation Talk:Tutorial Section 3.7"

From POV-Wiki
Jump to navigation Jump to search
m (continued wip ... more later)
m (done for now waiting a claification)
Line 230: Line 230:
 
   </td>
 
   </td>
 
</tr>
 
</tr>
</table>
 
 
<table class="matte" width="700px" cellpadding="0" cellspacing="10px">
 
 
<tr>
 
<tr>
 
   <td>
 
   <td>
Line 459: Line 456:
 
</table>
 
</table>
  
<p>Another important value is <code>pretrace_end</code>.  It specifies how many pretrace steps are calculated and thereby strongly influences the speed.  Usually lower values lead to better quality, but it is important to keep this in good relation to <code>error_bound</code>.</p>
+
<p>Another important setting is <code>pretrace_end</code>.  It specifies how many pretrace steps are calculated and thereby strongly influences the speed.  Usually lower values lead to better quality, but it is important to keep this in good relation to <code>error_bound</code>.</p>
  
 
<table class="matte" width="700px" cellpadding="0" cellspacing="10px">
 
<table class="matte" width="700px" cellpadding="0" cellspacing="10px">
Line 506: Line 503:
 
</table>
 
</table>
  
<p>Normally in the final trace no additional radiosity samples are taken unless absolutely needed. You can change this by adding <code>always_sample on</code>, allowing you to increase <code>pretrace_end</code> to speed up rendering. Note however that this is very prone to artifacts such as visible render block boundaries and horizontal "smearing", so it is usually only useful for test renders. You should also use a low setting for <code>nearest_count</code>, or you may actually <em>increase</em> the rendering time (<em>and</em> the probability of getting the mentioned artifacts!).</p>
+
<p>Normally in the final trace no additional radiosity samples are taken unless absolutely needed. You can change this by adding <code>always_sample on</code> allowing you to increase <code>pretrace_end</code> to speed up rendering. Note however that this is very prone to artifacts such as visible render block boundaries and horizontal &quot;smearing&quot;, so it is usually only useful for test renders. You should also use a low setting for <code>nearest_count</code>, or you may actually <em>increase</em> the rendering time, <em>and</em> the probability of getting the mentioned artifacts!.</p>
  
 
<table class="matte" width="700px" cellpadding="0" cellspacing="10px">
 
<table class="matte" width="700px" cellpadding="0" cellspacing="10px">
Line 514: Line 511:
 
   </td>
 
   </td>
 
   <td>
 
   <td>
     [[Image:TutImgRadA26.png|center|220px<!--class="centerpanel"--->]]
+
     [[Image:TutImgRadA1426.png|center|220px<!--class="centerpanel"--->]]
 
   </td>
 
   </td>
 
   <td>
 
   <td>
     [[Image:TutImgRadA1426.png|center|220px<!--class="rightpanel"--->]]
+
     [[Image:TutImgRadA26.png|center|220px<!--class="rightpanel"--->]]
 
   </td>
 
   </td>
 
</tr>
 
</tr>
Line 523: Line 520:
 
   <td>
 
   <td>
 
     <p class="caption">always_sample off</p>
 
     <p class="caption">always_sample off</p>
 +
  </td>
 +
  <td>
 +
    <p class="caption">always_sample on (difference)</p>
 
   </td>
 
   </td>
 
   <td>
 
   <td>
 
     <p class="caption">always_sample on</p>
 
     <p class="caption">always_sample on</p>
  </td>
 
  <td>
 
    <p class="caption">always_sample on (difference)</p>
 
 
   </td>
 
   </td>
 
</tr>
 
</tr>
Line 560: Line 557:
 
</table>
 
</table>
  
<p>You can strongly affect things with the objects' <!--<linkto "Finish">finishes</linkto>--->[[Documentation:Reference Section 5.1#Finish|finishes]]. In fact that is the most important thing about radiosity. Normal objects should have emission finish 0 (default). Objects with emission &gt; 0 actually act as light sources in radiosity scenes.</p>
+
<p>You can strongly affect things with an object's <!--<linkto "Finish">finishes</linkto>--->[[Documentation:Reference Section 5.1#Finish|finish]] attributes. In fact that is the most important thing about radiosity. Normal objects should have an <code>emission 0</code> (the default) finish. Objects with an emission setting greater than zero actually act as light sources in radiosity scenes. Remember that the default finish values used until now were <code>diffuse 0.65</code> and <code>emission 0</code>.</p>
 
 
<p>Remember that the default finish values used until now were <code>diffuse 0.65 emission 0</code>.</p>
 
  
 
<table class="matte" width="700px" cellpadding="0" cellspacing="10px">
 
<table class="matte" width="700px" cellpadding="0" cellspacing="10px">
Line 590: Line 585:
  
 
<p>Finally you can vary the sky in outdoor radiosity scenes. In all these examples it is implemented with a sphere object.
 
<p>Finally you can vary the sky in outdoor radiosity scenes. In all these examples it is implemented with a sphere object.
<code>finish { emission 1 diffuse 0 }</code> and the pigment of the original sample scene were used until now. The following images show some variations:</p>
+
<code>finish { emission 1 diffuse 0 }</code> and the pigment of the original sample scene were used until now. The following images show some variations.</p>
  
 
<table class="matte" width="700px" cellpadding="0" cellspacing="10px">
 
<table class="matte" width="700px" cellpadding="0" cellspacing="10px">
Line 612: Line 607:
 
   </td>
 
   </td>
 
   <td>
 
   <td>
     <p class="caption">rgb <1,0.8,0> to blue 1 gradient</p>
+
     <p class="caption">rgb &lt;1,0.8,0&gt; to blue 1 gradient</p>
 
   </td>
 
   </td>
 
</tr>
 
</tr>
 
</table>
 
</table>

Revision as of 17:36, 21 January 2011

Radiosity with conventional lighting

This section will introduce you to the technique of combining conventional and radiosity lighting. In this part of the tutorial, we'll be using basically the same sample scene that's located at ~/scenes/radiosity/radiosity2.pov, however by changing various radiosity parameters, we'll be able to explore the effects that those changes can have on the scenes appearance and in some cases the render time. Later on, in this tutorial, you can find examples of pure radiosity illumination.

Note: Unless otherwise stated all the images in this section were rendered with the following radiosity settings:

  global_settings {
    radiosity {
      pretrace_start 0.08
      pretrace_end   0.01
      count 150
      nearest_count 10
      error_bound 0.5
      recursion_limit 3
      low_error_factor 0.5
      gray_threshold 0.0
      minimum_reuse 0.005
      maximum_reuse 0.2
      brightness 1
      adc_bailout 0.005
    }
  }

Finally, a few more things about the scene setup. All objects except the sky have diffuse 0.65 and emission 0 in their finish block. The sky sphere has a bright blue pigment (what a surprise) with diffuse 0 and emission 1.0 as finish attributes.

Note: If using the sky_sphere object, which does not support the finish keyword, instead of a sphere object that does, you will need define a #default finish in order to affect it's finish properties.

For example:

#default {finish { diffuse 0 emission 1 }}

Hint: You can easily turn radiosity on/off with the use of a conditional statement.

#declare UseRad = yes;

  global_settings {
  #if (UseRad)
    radiosity {
      rad settings ...
    }
  #end
  }

OK, let's get started! In this set of images we first have the scene as it should appear without radiosity, in other words the radiosity block has been removed, next with the settings noted above, and finally an image showing the difference between the two. Looking at the difference image, you can see that radiosity greatly affects the shadowed areas when applied in combination with conventional lighting.

Note: The use of emission 1 in the finish block of the blue sky is what gives the bluish touch of the whole scene in the radiosity version, as it functions as kind of a diffuse light source.

TutImgRadA01.png
TutImgRadA03.png
TutImgRadA0103.png

no radiosity

radiosity

difference w/o radiosity

Radiosity is a highly tunable process, and it comes equipped with a variety of tunable parameters that make it easy to strike a balance between quality and rendering speed. However, as with most things, higher quality means more render time. Patience is a virtue.

For instance, let's examine our test object with default settings, with our reference settings, and finally with some maddeningly high-quality settings. For comparison, below each image you can see the difference to the high-quality version.

TutImgRadA02.png
TutImgRadA99.png
TutImgRadA03.png

default settings

high-quality render

tutorial reference settings

TutImgRadA0299.png
TutImgRadA0399.png

default settings (difference)

tutorial reference settings (difference)

Changing the brightness changes the intensity of radiosity effects. Theoretically specifying brightness 0 would be the same as without radiosity, however in practice POV-Ray doesn't accept a zero value. As a rule brightness 1 should work correctly in most cases. If the effects are too strong you can reduce this, though this is not recommended, as it's usually an indication that your textures are too bright and your illumination too dim. Larger values can lead to quite strange results in most cases.

TutImgRadA04.png
TutImgRadA03.png
TutImgRadA05.png

brightness 0.5

brightness 1.0

brightness 2.0

The recursion_limit setting primarily affects the brightness of shadows, nooks and corners. The following group of images show the results of setting this parameter to 1, 2 and 5 respectively ...

TutImgRadA06.png
TutImgRadA07.png
TutImgRadA08.png

recursion_limit 1

recursion_limit 2

recursion_limit 5

... while this next grouping shows the difference when compared to our reference setting of recursion_limit 3. As you can see, values higher than 3 do not lead to any better results in such a quite simple scene. In most cases values of 1 or 2 are sufficient, especially for outdoor scenes.

TutImgRadA0306.png
TutImgRadA0307.png
TutImgRadA0308.png

recursion_limit 1 (difference)

recursion_limit 2 (difference)

recursion_limit 5 (difference)

The error_bound setting mainly affects the structures of the shadows. Values larger than the default of 1.8 do not have much effect, they make the shadows even flatter. Extremely low values can lead to very good results, but the rendering time can become very long, and you may need to modify other parameters to avoid a grainy appearance.

TutImgRadA09.png
TutImgRadA10.png
TutImgRadA11.png

error_bound 0.01

error_bound 1.0

error_bound 1.8

TutImgRadA0309.png
TutImgRadA0310.png
TutImgRadA0311.png

error_bound 0.01 (difference)

error_bound 1.0 (difference)

error_bound 1.8 (difference)

Somewhat related to error_bound is low_error_factor. It reduces error_bound setting during the pretrace phase, changing this can be useful to eliminate artifacts. The difference images used the low_error_factor 0.5 case for comparison.

TutImgRadA12.png
TutImgRadA03.png
TutImgRadA13.png

low_error_factor 0.01

low_error_factor 0.5

low_error_factor 1.0

TutImgRadA0312.png
TutImgRadA0313.png

low_error_factor 0.01 (difference)

low_error_factor 1.0 (difference)

This next sequence of images illustrate the effect of count. It is a general quality and accuracy parameter leading to higher quality and slower rendering at higher values. Keep in mind that higher count isn't necessarily a cure-for-all when it comes to quality. The difference images were compared to a count 150 case.

Note: Until otherwise noted the following settings are being used to emphasize the effects of the next parameters we'll be examining.

  • recursion_limit 1
  • error_bound 0.2
  • low_error_factor 1.0
TutImgRadA15.png
TutImgRadA16.png
TutImgRadA17.png

count 2

count 35 (default)

count 1000

TutImgRadA1415.png
TutImgRadA1416.png
TutImgRadA1417.png

count 2 (difference)

count 35 (difference)

count 1000 (difference)

Another parameter that affects quality is nearest_count. You can use values ranging from 1 to 20 the default is 5. Just like count, higher values can lead to less artifacts and smoother appearance but slower rendering. The nearest_count setting also accepts a second parameter, which activates adaptive pretrace, providing a good means of speeding up pretrace without significant loss of quality (not shown here) the value must be smaller than the first parameter (e.g. nearest_count 20,10). When set, POV-Ray will stop pretracing individual areas of the image where the average sample density already satisfies this second value, thereby avoiding tracing low-detail areas over and over again for little gain, while still being able to drill down deep into high-detail areas. A setting of nearest_count 10 was used for the comparison.

TutImgRadA18.png
TutImgRadA19.png
TutImgRadA20.png

nearest_count 1

nearest_count 5 (default)

nearest_count 20

TutImgRadA1418.png
TutImgRadA1419.png
TutImgRadA1420.png

nearest_count 1 (difference)

nearest_count 5 (difference)

nearest_count 20 (difference)

minimum_reuse influences at which minimum distance previous radiosity samples are always reused during calculation, affecting quality and smoothness in nooks and corners. Higher values generally give a smoother appearance, at the cost of corner detail, while lower values may cause corners to look splotchy unless the other parameters (most notably count and nearest_count) are set for higher quality as well.

As minimum_reuse must be lower than maximum_reuse, to avoid a parse error with the highest setting we're using minimum_reuse 4.0 for these next three images.

TutImgRadA22.png
TutImgRadA23.png
TutImgRadA21.png

minimum_reuse 0.2

minimum_reuse 0.015

minimum_reuse 0.005

TutImgRadA2122.png
TutImgRadA2123.png

minimum_reuse 0.2 (difference)

minimum_reuse 0.015 (difference)

Another important setting is pretrace_end. It specifies how many pretrace steps are calculated and thereby strongly influences the speed. Usually lower values lead to better quality, but it is important to keep this in good relation to error_bound.

TutImgRadA24.png
TutImgRadA14.png
TutImgRadA25.png

pretrace_end 0.2

pretrace_end 0.01

pretrace_end 0.001

TutImgRadA1424.png
TutImgRadA1425.png

pretrace_end 0.2

pretrace_end 0.001

Normally in the final trace no additional radiosity samples are taken unless absolutely needed. You can change this by adding always_sample on allowing you to increase pretrace_end to speed up rendering. Note however that this is very prone to artifacts such as visible render block boundaries and horizontal "smearing", so it is usually only useful for test renders. You should also use a low setting for nearest_count, or you may actually increase the rendering time, and the probability of getting the mentioned artifacts!.

TutImgRadA14.png
TutImgRadA1426.png
TutImgRadA26.png

always_sample off

always_sample on (difference)

always_sample on

The effect of max_sample is similar to brightness. It does not reduce the radiosity effect in general but weakens samples with brightness above the specified value.

TutImgRadA27.png
TutImgRadA28.png
TutImgRadA14.png

max_sample 0.5

max_sample 0.8

max_sample not set (default)

You can strongly affect things with an object's finish attributes. In fact that is the most important thing about radiosity. Normal objects should have an emission 0 (the default) finish. Objects with an emission setting greater than zero actually act as light sources in radiosity scenes. Remember that the default finish values used until now were diffuse 0.65 and emission 0.

TutImgRadA29.png
TutImgRadA30.png
TutImgRadA31.png

diffuse 0.65 emission 0.2

diffuse 0.4 emission 0

diffuse 1.0 emission 0

Finally you can vary the sky in outdoor radiosity scenes. In all these examples it is implemented with a sphere object. finish { emission 1 diffuse 0 } and the pigment of the original sample scene were used until now. The following images show some variations.

TutImgRadA32.png
TutImgRadA33.png
TutImgRadA34.png

emission 0 diffuse 1

emission 0 diffuse 0 (no sky)

rgb <1,0.8,0> to blue 1 gradient