Reference:Crackle Pattern

From POV-Wiki
Revision as of 21:27, 4 May 2016 by Clipka (talk | contribs) (added repeat)
Jump to navigation Jump to search

The crackle pattern is a set of random tiled multifaceted cells. The crackle pattern is only semi-procedural, requiring random values to be computed and cached for subsequent queries, with a fixed amount of data per unit-cube in crackle pattern coordinate space. Scaled smaller than the density of actual ray-object-intersections computed, it will eventually lead to a separate crackle cache entry being created for each and every intersection. After the cache reaches a certain size (currently 30mb per thread), new entries for that particular block will be discarded after they are calculated. Starting a new block will allow the caching to resume working again. While discarding the data is of course inefficient, it's still preferable to chewing up 100% of the available physical RAM and then hitting the swap-file.

There is a choice between different types:

Standard Crackle

Mathematically, the set crackle(p)=0 is a 3D Voronoi diagram of a field of semi random points and crackle(p) < 0 is the distance from the set along the shortest path (a Voronoi diagram is the locus of points equidistant from their two nearest neighbors from a set of disjoint points, like the membranes in suds are to the centers of the bubbles).

  • With a large scale and no turbulence it makes a pretty good stone wall or floor.
  • With a small scale and no turbulence it makes a pretty good crackle ceramic glaze.
  • Using high turbulence it makes a good marble that avoids the problem of apparent parallel layers in traditional marble.

Form

pigment {
  crackle form <FORM_VECTOR>
  [PIGMENT_ITEMS ...]
  }

normal {
  crackle [Bump_Size]
  form <FORM_VECTOR>
  [NORMAL_ITEMS ...]
  }

Form determines the linear combination of distances used to create the pattern. Form is a vector.

  • The first component determines the multiple of the distance to the closest point to be used in determining the value of the pattern at a particular point.
  • The second component determines the coefficient applied to the second-closest distance.
  • The third component corresponds to the third-closest distance.

The standard form is <-1,1,0> (also the default), corresponding to the difference in the distances to the closest and second-closest points in the cell array. Another commonly-used form is <1,0,0>, corresponding to the distance to the closest point, which produces a pattern that looks roughly like a random collection of intersecting spheres or cells.

  • Other forms can create very interesting effects, but it is best to keep the sum of the coefficients low.
  • If the final computed value is too low or too high, the resultant pigment will be saturated with the color at the low or high end of the color_map. In this case, try multiplying the form vector by a constant.

Metric

pigment {
  crackle metric METRIC_VALUE
  [PIGMENT_ITEMS ...]
  }

normal {
  crackle [Bump_Size]
  metric METRIC_VALUE
  [NORMAL_ITEMS ...]
  }

Changing the metric changes the function used to determine which cell center is closer, for purposes of determining which cell a particular point falls in. The standard Euclidean distance function has a metric of 2. Changing the metric value changes the boundaries of the cells. A metric value of 3, for example, causes the boundaries to curve, while a very large metric constrains the boundaries to a very small set of possible orientations.

  • The default for metric is 2, as used by the standard crackle texture.
  • Metrics other than 1 or 2 can lead to substantially longer render times, as the method used to calculate such metrics is not as efficient.

Offset

pigment {
  crackle offset OFFSET_VALUE
  [PIGMENT_ITEMS ...]
  }

normal {
  crackle [Bump_Size]
  offset OFFSET_VALUE
  [NORMAL_ITEMS ...]
  }

The offset is used to displace the pattern from the standard xyz space along a fourth dimension.

  • It can be used to round off the pointy parts of a cellular normal texture or procedural heightfield by keeping the distances from becoming zero.
  • It can also be used to move the calculated values into a specific range if the result is saturated at one end of the color_map.
  • The default offset is zero.

Repeat

pigment {
  crackle repeat VECTOR
  [PIGMENT_ITEMS ...]
  }

normal {
  crackle [Bump_Size]
  repeat VECTOR
  [NORMAL_ITEMS ...]
  }

Template:New.3.7.1 Causes the pattern to repeat seamlessly at regular intervals along the X, Y and/or Z axis, as specified by the corresponding components of the specified vector. Values of 0 indicate no repetition along the corresponding axis. For technical reasons, only integer intervals are supported. The default for this parameter is <0,0,0>, i.e. no repetition.

Solid

pigment {
  crackle solid
  [PIGMENT_ITEMS ...]
  }

normal {
  crackle [Bump_Size]
  solid
  [NORMAL_ITEMS ...]
  }

Causes the same value to be generated for every point within a specific cell. This has practical applications in making easy stained-glass windows or flagstones. There is no provision for mortar, but mortar may be created by layering or texture-mapping a standard crackle texture with a solid one. The default for this parameter is off.

RefImgCracklePigment.png
RefImgCrackleNormal.png

crackle pattern used as pigment and normal respectively