This Worley Noise implementation uses unit cubes to subdivide a 3d volume. It then uses this 3d indices to hash a seed for a RNG. A Poisson distribution is used to grab the probable number of feature points in the specific cube. Those feature points are spawned, and the two closest points are selected. This specific implementation subtracts the closest point from the second closest, generating a natural stone look.
I used the Worley Noise function to create a filtering material. This material wraps over another material. Whenever a ray is generated or luminance is computed, the WorleyFilter uses its host's methods, and then scales the color by the worley scale at that hit position. This creates the texture.
As I implemented Worley Noise for the textures, I decided to apply displacement mapping as well. To get enough triangles, I started with the original MakeBox function for the first 12. I then created a function 'Tesselate' that uses part of the Loop triangle subdivision alogrithm. I recursed around 7 times for each box I made, creating around 200,000 triangles each, then displaced the triangles and recalculated the normals using Worley Noise.