POV-Ray : Documentation : 2.5.11.30 Slope
  POV-Ray 3.6 Documentation Online View  
2.5.11.29 Ripples   2.5.11.31 Spherical

2.5.11.30 Slope

The slope pattern uses the normal of a surface to calculate the slope at a given point. It then creates the pattern value dependent on the slope and optionally the altitude. It can be used for pigments, normals and textures, but not for media densities. For pigments the syntax is:

  pigment {
    slope {
      <Direction> [, Lo_slope, Hi_slope ]
      [ altitude <Altitude> [, Lo_alt, Hi_alt ]]
    }
    [PIGMENT_MODIFIERS...]
  }

The slope value at a given point is dependent on the angle between the <Direction> vector and the normal of the surface at that point. For example:
- When the surface normal points in the opposite direction of the <Direction> vector (180 degrees), the slope is 0.0.
- When the surface normal is perpendicular to the <Direction> vector (90 degrees), the slope is 0.5.
- When the surface normal is parallel to the <Direction> vector (0 degrees), the slope is 1.0.

When using the simplest variant of the syntax:

  slope { <Direction> }

the pattern value for a given point is the same as the slope value. <Direction> is a 3-dimensional vector and will usually be <0,-1,0> for landscapes, but any direction can be used.

By specifying Lo_slope and Hi_slope you get more control:

  slope { <Direction>, Lo_slope, Hi_slope }

Lo_slope and Hi_slope specifies which range of slopes are used, so you can control which slope values return which pattern values. Lo_slope is the slope value that returns 0.0 and Hi_slope is the slope value that returns 1.0.

For example, if you have a height_field and <Direction> is set to <0,-1,0>, then the slope values would only range from 0.0 to 0.5 because height_fields cannot have overhangs. If you do not specify Lo_slope and Hi_slope, you should keep in mind that the texture for the flat (horizontal) areas must be set at 0.0 and the texture for the steep (vertical) areas at 0.5 when designing the texture_map. The part from 0.5 up to 1.0 is not used then. But, by setting Lo_slope and Hi_slope to 0.0 and 0.5 respectively, the slope range will be stretched over the entire map, and the texture_map can then be defined from 0.0 to 1.0.

By adding an optional <Altitude> vector:

  slope {
    <Direction>
    altitude <Altitude>
  }

the pattern will be influenced not only by the slope but also by a special gradient. <Altitude> is a 3-dimensional vector that specifies the direction of the gradient. When <Altitude> is specified, the pattern value is a weighted average of the slope value and the gradient value. The weights are the lengths of the vectors <Direction> and <Altitude>. So if <Direction> is much longer than <Altitude> it means that the slope has greater effect on the results than the gradient. If on the other hand <Altitude> is longer, it means that the gradient has more effect on the results than the slope.

When adding the <Altitude> vector, the default gradient is defined from 0 to 1 units along the specified axis. This is fine when your object is defined within this range, otherwise a correction is needed. This can be done with the optional Lo_alt and Hi_alt parameters:

  slope {
    <Direction>
    altitude <Altitude>, Lo_alt, Hi_alt
  }

They define the range of the gradient along the axis defined by the <Altitude> vector.

For example, with an <Altitude> vector set to y and an object going from -3 to 2 on the y axis, the Lo_alt and Hi_alt parameters should be set to -3 and 2 respectively.

Note:

  • You may use the turbulence keyword inside slope pattern definitions but it may cause unexpected results. Turbulence is a 3-dimensional distortion of a pattern. Since slope is only defined on surfaces of objects, a 3-dimensional turbulence is not applicable to the slope component. However, if you are using altitude, the altitude component of the pattern will be affected by turbulence.
  • If your object is larger than the range of altitude you have specified, you may experience unexpected discontinuities. In that case it is best to adjust the Lo_alt and Hi_alt values so they fit to your object.
  • The slope pattern does not work for the sky_sphere, because the sky_sphere is a background feature and does not have a surface. similarly, it does not work for media densities.
2.5.11.29 Ripples   2.5.11.31 Spherical


Copyright 2003-2021 Persistence of Vision Raytracer Pty. Ltd.