HFC Tutorial

Third part: close-up improvements

A close-up look at the cliff, though much better looking from a remote point of view than its first version, shows a pitiful picture:

Some new options allow to improve this result.

Curved blades

Basic blades made of two crossed triangles allow us to preview how grass spreads over the HF, but do not allow close-up views. The second export module replaces them with curved, smooth blades.

Brins courbes [6k]

Each curved blade is made of several smoothed triangles following a curved path. This layout needs some additional parameters.

The angle ranges specify the possible random values of the respective angles at the beginning and tip of the leaf. These values must be taken in the 0-90° range.

Tightness tunes whether the blades are likely to bend smoothly or suddenly near either end:

brins souples
raide [11k]
Tightness = 0
Tightness = 1

Resolution is simply the number of triangles per half-blade. The default value is 10 and is suitable for most uses except extreme close-ups. The valid range is 5-100.

Area coverage

It may be useful to allow the ground to be more or less visible under the blades. To do so, it is possible to tune blade width, blades amount,or export scale. The "area coverage" parameter tunes the overall visibility of the gound, adjusting blades width. The higher the parameter, the wider the blades, and the lower the gound will be visible. The idea behind this parameter is that the global ground coverage will not change in case scale or number of blades is modified.

UV-mapping

At this point, our grass has a plain green pigment. A first improvement could consist in globally texturing the field, like this:

union{
   #include "grass.inc"
   pigment {
     bozo color_map {
       [0 Green]
       [1 ForestGreen]
       }
     scale 5
     }
   }

The result might be sufficient for remote views, but will be just bad for close-up. Moreover, usual methods like using a vertical gradient to change the colour along the blades cannot be used, since grass blades are located at different heights over the HF.

However, uv-mapping a feature introduced in MegaPOV and ported to POV-Ray 3.5. Every point of each blade is mapped with implicit, 2D coordinates called u and v, which can be used to spread textures. U and V coordinates have the same shape for every blade, just having a different random "horizontal" offset, allowing a different but similar texturing for each individual blade:

POV-Ray code describing a progressive pigment change along the blade length can be coded as follows:

#declare txtGrass=texture {
  uv_mapping
  pigment {
    gradient y
    turbulence 0.2
    pigment_map {
      [0.20 pigEarth]
      [0.45 pigGreen]
      [0.75 pigSpotted]
      [1.00 pigEarth]
    }
  }
  finish{
    ambient 0
    diffuse 0.7
    specular 0.2 roughness 0.015
    phong 0.5 phong_size 10
  }
  scale <0.001,1,0.001>
}

union{
   #include "grass.inc"
   texture {txtGrass}
   }

It is even possible to go further, mixing uv-mapping and regular mapping. It is not straightforward as POV-Ray still does not support layering patterned textures, but a possible method could be like this:

#declare txtBurntGrass =texture{
  pigment {
    spotted
    color_map {
      [0.0, 0.2   color Tan*0.4 color Tan*1]
      [0.2, 0.3   color Tan*1 color Green*1]
      [0.3, 0.7   color Green*1
                  color rgb <.8, 1, .4>*1.5]
    }
  }
}

#declare txtComplexGrass = texture {
  bozo texture_map{
    [0.3 txtGrass]
    [0.7 txtBurntGrass]
  }
  scale 1
}

union{
   #include "grass.inc"
   texture {txtComplexGrass}
   }
 

It is even possible to use a material map to obtain precise patterns like those made by flying saucer landings...

Tufts

The default layout for blades is a fairly simplistic, individual, more or less uniform one. HFC features a more realistic algorithm giving better results in close-up. Its main drawback is that, as it groups blades into tufts, it artificially alters the area coverage which might need some adjustment is some cases, while increasing the number of blades may be a good way to go.

It is fairly simple to set up: just tell the average number of blades per tuft. The algorithm also takes the blade growth probability to adjust both the actual number of blades for a given tuft, and the average length of the blades: the lower the probability, the harder life is.

What's next ?

Well... nothing. You don't need more to make the main page picture.

If you have suggestions or request, just drop me an e-mail or, better, join us at the french-speaking irc channel #povray-fr (undernet) if you can.

 


2. General improvements Contents


© François Dispot 2003