worley.h
1 /* Copyright 1994, 2002 by Steven Worley
2  This software may be modified and redistributed without restriction
3  provided this comment header remains intact in the source code.
4  This code is provided with no warrantee, express or implied, for
5  any purpose.
6 
7  A detailed description and application examples can be found in the
8  1996 SIGGRAPH paper "A Cellular Texture Basis Function" and
9  especially in the 2002 book "Texturing and Modeling, a Procedural
10  Approach, 3rd edition." There is also extra information on the web
11  site http://www.worley.com/cellular.html .
12 
13  If you do find interesting uses for this tool, and especially if
14  you enhance it, please drop me an email at steve@worley.com. */
15 
16 
17 
18 /* Worley()
19 
20  An implementation of the key cellular texturing basis
21  function. This function is hardwired to return an average F_1 value
22  of 1.0. It returns the <n> most closest feature point distances
23  F_1, F_2, .. F_n the vector delta to those points, and a 32 bit
24  seed for each of the feature points. This function is not
25  difficult to extend to compute alternative information such as
26  higher order F values, to use the Manhattan distance metric, or
27  other fun perversions.
28 
29  <at> The input sample location.
30  <max_order> Smaller values compute faster. < 5, read the book to extend it.
31  <F> The output values of F_1, F_2, ..F[n] in F[0], F[1], F[n-1]
32  <delta> The output vector difference between the sample point and the n-th
33  closest feature point. Thus, the feature point's location is the
34  hit point minus this value. The DERIVATIVE of F is the unit
35  normalized version of this vector.
36  <ID> The output 32 bit ID number which labels the feature point. This
37  is useful for domain partitions, especially for coloring flagstone
38  patterns.
39 
40  This implementation is tuned for speed in a way that any order > 5
41  will likely have discontinuous artifacts in its computation of F5+.
42  This can be fixed by increasing the internal points-per-cube
43  density in the source code, at the expense of slower
44  computation. The book lists the details of this tuning. */
45 
46 namespace VoxelFarm
47 {
49  void Worley(
51  double at[3],
53  long max_order,
55  double F[2],
57  double delta[2][3],
59  unsigned long ID[2]);
60 
61 }
Contains all classes and functions for the VoxelFarm engine.
void Worley(double at[3], long max_order, double F[2], double delta[2][3], unsigned long ID[2])
Cellular noise.