Procedural texturing: Difference between revisions

Jump to navigation Jump to search
Line 678: Line 678:


The overlay layer is created by extruding a number of 'shells' from the base ground surface (with a LOD system controlling how many shells are extruded) and texturing the part of the shell which intersects with the 3d structure of the object to be rendered. This looks fairly compelling from above, but of course for shallow viewing angles the nature of the illusion is readily apparent, and once the view direction is parallel to the shells, the 3D structure vanishes because one is looking right between shells. It's therefore a good idea to keep the overlay layer low (< 1 m) and supplement it with other elements such as random vegetation.
The overlay layer is created by extruding a number of 'shells' from the base ground surface (with a LOD system controlling how many shells are extruded) and texturing the part of the shell which intersects with the 3d structure of the object to be rendered. This looks fairly compelling from above, but of course for shallow viewing angles the nature of the illusion is readily apparent, and once the view direction is parallel to the shells, the 3D structure vanishes because one is looking right between shells. It's therefore a good idea to keep the overlay layer low (< 1 m) and supplement it with other elements such as random vegetation.
The overlay layer needs to be both enabled in user preferences and requested by the landclass definition to be shown. In the materials file, the corresponding effect needs to be set as
<syntaxhighlight lang="xml">
      <effect>Effects/terrain-overlay</effect>
</syntaxhighlight>
to enable the layer. If the overlay is not selected in the ALS quality levels, the effect will automatically fall back to terrain-default (the same will happen if ALS is not selected as renderer).
In the materials file, a number of parameters govern the appearance of the overlay layer. The following example is from Hawaii texturing (here (...) means that these declarations for the layer need to be done in addition to other procedural texturing described above).
<syntaxhighlight lang="xml">
        <texture-set>
          (...)
  <texture n="20">Terrain/dry_pasture4.png</texture>
  <texture n="21">Terrain/dry_pasture4.png</texture>
</texture-set>
<parameters>
          (...)
  <max_overlay_height>1.0</max_overlay_height>
  <overlay_hardness>0.0</overlay_hardness>
  <overlay_density>0.6</overlay_density>
  <overlay_scale>2.0</overlay_scale>
  <overlay_autumn_flag>0</overlay_autumn_flag>
  <overlay_brightness_top>0.8</overlay_brightness_top>
  <overlay_brightness_bottom>0.4</overlay_brightness_bottom>
  <overlay_secondary_flag>1</overlay_secondary_flag>
  <overlay_secondary_hardness>0.0</overlay_secondary_hardness>
  <overlay_secondary_density>1.0</overlay_secondary_density>
        </parameters>
</syntaxhighlight>
Let's go through these entries.
First, the overlay layer can support two different structures with different textures (for instance undergrowth and rock). The number 20 defines the texture for the primary layer, the number 21 for the secondary layer. The code makes an assumption that the secondary layer is smaller in height than the primary layer, so plan accordingly.
The first four parameters determine the apparent geometry of the overlay objects. All 'objects' (which really are painted on the shells only, remember) are based on Perlin noise to give them a pseudo-random appearance. <b><max_overlay_height></b> is the maximal distance the upper layer will be extruded from the ground - the largest of the random structures will reach to this level. As mentioned above, it's generally a good idea to keep this < 1 m (although the effect will run for higher numbers). The <b><overlay_hardness></b> is a number between 0 and 1 and determines how blurry the edges of the structures will be - generally for vegetation one wants a now hardness, for rock (see below) a high hardness to get the illusion of a well-defined surface).


[[File:Overlay03.jpg|500px|center|Overlay layer used as rock]]
[[File:Overlay03.jpg|500px|center|Overlay layer used as rock]]
The <b><overlay_density></b> determines how much overlay objects there will be (technically, it's a bias for the Perlin noise) - a high density will give a nearly closed layer, a low density instead only a few objects far and between. Finally, the <b><overlay_scale></b> is a parameter used to stretch the noise pattern horizontally. By default, the pattern is around 1-2 m scale, setting the parameter e.g. to 5 will stretch this horizontally to 5-10 m (while leaving the vertical height constant).


=== Pixel color postprocessing ===
=== Pixel color postprocessing ===
1,360

edits

Navigation menu