imagico.de
imagico.de

imagico.de

Water

previous: Realistic water with Povray - part 3 current: Realistic water with Povray - part 4 next: Realistic water with Povray - part 5 Navigation

Realistic water with POV-Ray - interior

This part deals with the interior statement and it's content, for the other parts of the tutorial go to the tutorial starting page.

The interior statement of a shape in POV-Ray describes everything that's going on inside an object. Originally raytracing deals only with the surfaces of objects, therefore until POV-Ray 3.1 there was no interior statement and all necessary aspects of it were part of the finish. Anyway the different parts of the interior are quite important for realistic water.

ior

In all the previous renders I already used one interior component: ior or index of refraction. technically it's the ratio of light speed in vacuum to that in the material and it's the number that steers refraction.

interior {
  ior [Value]
}

ior 1.05 ior 1.3 ior 2.5
ior 1.05 ior 1.3 ior 2.5

These samples also use fresnel reflection so you can see the effect on this too.

According to external linkLuxpop, the ior of pure water, Temperature 10° Celsius, wavelength 600 nm, is 1.33382. It depends on the temperature, light frequency and most important the salinity.

The influence of temperature is quite low, the index slightly decreases with higher temperatures. Salinity is more important, with 35 g/litre (average ocean water) it is about 1.34.

More details on this matter can be found in various links.

The wavelength dependency of the ior is described by another parameter: dispersion. The value is ratio of ior values at both ends of the visible spectrum. It can usually be neglected, a realistic value would be 1.01.

interior {
  ior 1.3
  dispersion [Value]
}

dispersion 1.0 (default) dispersion 1.01 dispersion 1.5
dispersion 1.0 (default) dispersion 1.01 dispersion 1.5

Note that of course fresnel reflection is influenced by dispersion too.

attenuation and scattering

Apart from refraction there is another important issue about the interior: the attenuation and scattering of light.

Pure water at first appears to be totally clear, but there is some amount of molecular scattering just like in air. In many cases this can be neglected since real water is rarely pure and other factors are therefore much more important.

Particles in water like algae and mud usually lead to both scattering and absorption. The easiest way to model absorption is to use fading in the interior. There are two values to steer this, fade_distance which is the distance where half the light is absorbed and fade_power which defines the falloff function.

interior {
  ior 1.3
  fade_distance 2
  fade_power [Value]
}

fade_power 1 fade_power 3 fade_power 15
fade_power 1 fade_power 3 fade_power 15
fade_power 1 (difference) fade_power 3 (difference) fade_power 15 (difference)

interior {
  ior 1.3
  fade_distance [Value]
  fade_power 2
}

fade_distance 1 fade_distance 4 fade_distance 10
fade_distance 1 fade_distance 4 fade_distance 10

If you raise fade_power to more than 1000 POV-Ray uses exponential attenuation which is more realistic:

interior {
  ior 1.3
  fade_distance 4
  fade_power 1001
}

exponential attenuation exponential attenuation exponential attenuation

Normally fading is in black color meaning all colors are attenuated equally. Specifying fade_color colors the attenuation. The default value is <0, 0, 0> and using <1, 1, 1> will lead to no attenuation at all.

interior {
  ior 1.3
  fade_distance 4
  fade_power 1001
  fade_color <0.80.20.20.5>
}

fade_color fade_color fade_color

Another more realistic method to achieve attenuation is absorbing media. media is a very powerful feature in POV-Ray so i will only cover some general parts, for the various sampling parameters and the use of patterns for non constant media etc. see the official POV-Ray documentation.

Just like with fading, you can color the attenuation with media, but it works differently. The color specified is the color that is absorbed so the appearance will be in the complementary color:

interior {
  ior 1.3
  media {
    absorption <0.80.61.00.5>
  }
}

absorbing media absorbing media absorbing media

Note that by decreasing the values in the color vector you can diminish the absorption.

When using radiosity in combination with media it is important to use media on in the radiosity block. Otherwise the radiosity effects will not be influenced by the media. The next pictures show the results without:

radiosity: media off radiosity: media off radiosity: media off
  radiosity: media off (difference) radiosity: media off (difference)

Absorbing media only weakens the light, in reality scattering is often much more important. Scattering means incoming light is scattered into multiple directions. Calculating that is quite computation intensive although in POV-Ray 3.5 sampling method 3 improves efficiency quite a lot. It's often worth trying whether using some diffuse finish instead might be enough to get the desired effect.

Usually light is not scattered equally in all directions. POV-Ray offers various scattering functions for different purposes. For water "Mie" scattering is usually the most realistic version. There are two variations, "haze" and "murky". For the technical details have a look at the POV-Ray documentation.

The following samples use "Mie haze" (type 2):

interior {
  ior 1.3
  media {
    scattering { 2 <0.50.650.4> }
  }
}

mie haze (2) scattering mie haze (2) scattering mie haze (2) scattering

And now the same with "Mie murky" (type 3):

interior {
  ior 1.3
  media {
    scattering { 3 <0.50.650.4> }
  }
}

mie murky (3) scattering mie murky (3) scattering mie murky (3) scattering

The other scattering types are probably less useful for water:

type 1 (isotropic) type 4 (Rayleigh) type 5 (Henyey-Greenstein)
type 1 (isotropic) type 4 (Rayleigh) type 5 (Henyey-Greenstein)
type 1 (isotropic) type 4 (Rayleigh) type 5 (Henyey-Greenstein)

Scattering always involves absorption. How much light is absorbed can be controlled with the extinction parameter. The default value of 1.0 leads to a natural balance between scattering and absorption, reducing the value can help achieving desired results.

interior {
  ior 1.3
  media {
    scattering { 
      2 <0.50.650.4> 
      extinction [Value]
    }
  }
}

extinction 0.5 extinction 1.0 extinction 2.0
extinction 0.5 extinction 1.0 extinction 2.0

That's all for the interior, there's a third media type named emission, but it's not very useful for water. The next part is about the actual surface geometry of the water.

Continue with Part 5 (surface geometry).