« welcome
» 3d power texture lookup

xsi

xsi ICE cell noise

01.04.09 | 2 Comments

I made an ICE node for generating 3d cell noise. ( .. generating the 1st closest neighbour distance function)

xsi ICE cell noise generator

xsi ICE cell noise generator

This is a grid of ICE particles coloured by the cell noise node, with each particle displayed as a rectangle.

I understand the algorithm empirically, and I constructed the ICE node pretty much by making it do what I expected to see.

The node takes an input vector (here I’ve plugged in the particles’ .pointposition), discretises it’s position with a float rounding node into an integer, this creates the “cell” part of cell noise. Then it uses this int like a seed for a random number generator to create a random vector for each cell. Each input particle generates this random vector for the cell it’s in, and for each of it’s 26 neighbouring cells (because it’s 3d). Finally, the particle’s position is compared against its (and its neighbouring cells’) random vectors for distance, and then a scalar is generated based on the shortest length.

In executing this in an ICE tree, I had to create an array of 27 vector elements to describe each cell’s neighbour cell offsets. I have a feeling I could have done this with a nice loop structure, but it was very late and I was so close to solving it that I went with the good-old pen-and-paper-and-long-explicit-array approach :D

This means each particle pulling this ICE tree would be generating the same cells and random cell centers a whole bunch of times. The tree doesn’t cache the results for each cell, which would have been preferable, but it still seems to operate quite fast. ICE is magic stuff.

Maybe i could have one cloud generating the cell structure which caches the vector offsets, and another cloud of particles looking-up into the first for the result.

ICE cell noise Voronoi

ICE cell noise Voronoi

The node can also return the Voronoi diagram of the cell offsets. The colours represent the jittered cell center values, as compressed vectors.

To reconstruct the actual offset vectors, the colour has to be multiplied by 2 and added to -0.5.

ICE cell noise Voronoi tree

ICE cell noise Voronoi tree

This is all just a really quick test in making cell noise. Having used cell noise in 3d shading for years and years, it’s surprising that this is the very first time I’ve ever implemented it myself! Every one of the 3d softwares I’ve ever used has had an implementation of Worley cell noise in one form or another. It’s such a useful and Real Life-mimicking algorithm.

Things to improve:

  • speed :D (caching via 2nd point cloud)
  • output modes (2 closest neighbour function etc.)
  • random scaler for cell-offsets when comparing distances (so you can get small dots and large dots).
  • upload to the ICE resource center!

Here is a nice example of generating cell noise on the GPU.

Here is a nice example of 2d cell noise in Processing.

Tags: , , , ,

2 Comments

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">


« welcome
» 3d power texture lookup