Friday, February 17, 2012

Texture, Part 6

I have written of using Fourier transforms to process textures. Filtering is always more flexible in the frequency domain. Now I will give some more interesting examples of filtering, using non-isotropic filters.

I start with a slice-and-dice texture, really a gorgeous cellular texture, created by sampling a very soft texture and placing a copy within each cell of a Voronoi tessellation. And using crossfade sets and z-buffering to mesh the edges even in curves, as you see here.

I sampled a bright spot in the source texture, with a small dark spot immediately beneath it. I moved the source position in real time until I had the desired effect. It is fascinating to see the curves in the edges of the cells undulating in real time in response to the shifting source point. I don't think there is a real-world equivalent.

Next I implemented a new thing for Texture: anisotropic filtering. With these kinds of filters, I limit the angle range in the frequency domain to selected angles. This makes textures that can only have certain angles of features in them.

Here you see a soft spot filter that has been angle limited. I mentioned once before that the frequency domain representation of images must be reflection-symmetric about the origin. This defines what we can do with anisotropic filtering.

So I processed the above image with this filter and I got quite a different texture.

This texture is more scalloped than the above texture, but it is from the same exact source.

The vertical lines between the cells are almost gone and the horizontal edges are accentuated. It appears to be a new kind of shading for the cells: certainly less round than the source image.

This image becomes more like the scales on a reptile or some kind of tiered erosion.

It is important to note that, when angle-filtering, it is important to use a soft window on the angle limiting, to avoid angular ringing.
If I use a different filter, one with a hole in it, I am explicitly limiting the frequency range of the result in the manner of a notch filter. But it is still anisotropic, in other words: directionally biased.

You see to left the filter I used to create the next image.

Here we have chosen to accentuate the vertical edges between the cells, and the horizontal edges have almost completely disappeared.


This is the result: the cells are flatter and there are shines on the vertical edges, kind of like oddly-shaped chiclets.

With these renderings, you can almost feel the surface of the texture. Realism is a fun goal.

But this was also exploration.

Next I figured that, the more wavelengths I kept in, the more accurate the texture. It's the large wavelengths that define the smallest features. That's useful to know when designing filters for 2D images.

But, even though the spot size for the filter is at a maximum, still there is an angular limitation imposed and hence the unusual shape of the filter.

This shows the filter for the next image. You can see I kept all the wavelengths because the filter continues all the way to the edges of the square.

And there is also a severe angular limitation, that is the tightest restriction on angular data yet shown.

The image result is extremely detailed and sharp. It looks as if it were a pleated surface like a mattress or a down quilt.

The crescent-shaped depressions follow the original edges of the source image's valleys. But in this case, the horizontal divisions are completely eradicated.

The result processed image is almost squeaky clean and soapy.

Adding Color

I am interested in adding color to the slice-and-dice texture generator. At the very least, it could colorize each cell a little differently. It could also use a color image as the source with very little difficulty.

Adding color to the FFT area is also possible by processing each of the channels separately. Or I could split them into YCbCr with very little extra work.

When it comes to annealing, then color becomes problematic. Each channel may be annealed separately but there is no guarantee that it would maintain cohesion between the channels.

With speckles, the color assigned to each speckle could be defined like with the Voronoi cells.

Even hatching could be interesting in color, particularly the interpenetrating kind.

I am intrigued by this possibility.

It showed up in my notes from 1994.

Here you see an anneal of an anisotropically-filtered texture, done at high resolution. It feels like tree bark to me.

Many real world objects have directionality to them and clever use of anisotropic filtering can get us closer to simulating their look and feel.

No comments:

Post a Comment