Previous:Scattering Main Index Next:Density

Media effects are calculated by sampling the media along the path of the ray. It uses a method called *Monte Carlo integration.* The

keyword may be used to specify the integer number of intervals used to sample the ray. The default number of intervals is 10. For object media the intervals are spread between the entry and exit points as the ray passes through the container object. For atmospheric media, the intervals span entire length of the ray from its start until it hits an object.**intervals**

For media types which interact with spotlights or cylinder lights, the intervals which are not illuminated by these light types are weighted differently than the illuminated intervals when distributing samples. The

keyword distributes intervals differently between lit and unlit areas. The default value of **ratio**

means that lit intervals get more samples than unlit intervals. Note that the total number of intervals must exceed the number of illuminated intervals. If a ray passes in and out of 8 spotlights but you've only specified 5 intervals then an error occurs.**ratio 0.9**

The **samples***Min***,***Max* keyword specifies the minimum and maximum number of samples taken per interval. The default values are

. **samples 1,1**

As each interval is sampled, the variance is computed. If the variance is below a threshold value, then no more samples are needed. The

and **variance**

keywords specify the permitted variance allowed and the confidence that you are within that variance. The exact calculations are quite complex and involve chi-squared tests and other statistical principles too messy to describe here. The default values are **confidence**

and **varience 1.0/128**

. For slower more accurate results, decrease the variance and increase the confidence. Note however that the maximum number of samples limits the calculations even if the proper variance and confidence are never reached.**confidence 0.9**

Previous:Scattering Main Index Next:Density