Filter Construction: Noise Lore

From Filter Forge Wiki

Jump to: navigation, search

Contents


This chapter of The DOs and DON'Ts of Filter Construction talks about all those things you should know about Perlin & Worley!

Noise Detail

Image:Noise detail 01.jpg

An example of very sloppy filter construction: A high-detail Perlin Noise (Roughness and Details are both set to 100!) is connected to a Checker component that has the Solid Fill option active. While this is a perfectly valid technique to achieve a pixelized noise, the detail of the Perlin Noise is completely lost in the process: Each 'check' derives its uniform color value from a sample taken from the source image input. In the case above, we are effectively taking only 16 samples of a very fine-grained noise. Naturally, this should be immediately apparent as a complete and total waste!

Image:Noise detail 02.jpg

Let us remedy the wastefulness: Set Roughness and Details to zero. Yes, it is that easy, folks! Notice that the Checker result exhibits a little more contrast now (which can be remedied by lowering the Contrast value on the Perlin Noise), but for all intents and purposes, this solution is visually equivalent yet much more efficient.

Conclusion: Whenever noises are used in filter construction, great care needs to be taken. Always make sure a noise only generates the detail that is absolutely necessary, not more!

Image:Noise detail 02a.jpg

One thing still remains: We need to make sure we are sampling from a noise field that is as uniformly chaotic as possible. At a Scale of 250, the noise still has much localized 'unique' detail. Reducing this value to zero creates a uniform grain field with a truly chaotic sample distribution, leading to a much more even pixelization effect on the Checker component. As you can see, the Scale parameter also plays an important role in noise detail management.

Image:Noise detail 03.jpg

There is a relationship between the Roughness and the Details parameters that must be understood. Consider the row of four Perlin Noise renderings above (which have been rendered on a 'slow' 1GHz athlon CPU at an original size of 1200x1200 pixels). Do you see any difference between the renderings? I think we can safely agree that - for all practical purposes - there is very little. Try this for yourself. Can you see a difference? In reality there is one (see below), but in most cases it is totally negligible (and the significant render-time increase unnecessary).

Let us take a look at the parameter settings: Roughness remains at a constant value of 25 for all renderings, the Details parameter is reduced by 25 for each step. There is little visual difference in the renderings yet the render-time comes down significantly the lower the Details go!

So what is going on here? For low values in the zero to 30 range, additional fine-grained noise octaves resulting from higher Details are being blended in gradually, but the large-grained first octave still has the greatest visibility. Because of this, the visual differences were very slight, as we observed above. For higher Roughness values, the finer-grained octaves become much more opaque and their details more visible, so higher Details settings actually do make a difference there.

This leads us to a simple conclusion: If we are using low Roughness values, Details settings larger than the Roughness are practically just wasting render-time!!! In consequence, for the case illustrated above, the best Details setting would probably be somewhere around 25. If you actually wanted a finer grained noise however, the Roughness should be increased and the Details adjusted accordingly.

Image:Noise detail 05.jpg

A small side-note to the above paragraph and rule: If you use the noise as a Height Map (i.e. you are feeding it into the Height input of the Result component), you will see that a Details parameter value higher than the Roughness parameter value actually does have an effect: the fine-grained octaves become very visible. This is due to the Height input being very sensitive to the small noise octaves that are introduced at higher Details settings. The surface lighting also adds to this effect by exaggerating the noise relief. In certain cases this fine grain might be desireable, but be aware that it always comes at the cost of render-time!

Image:Noise detail 04.jpg

So then, what if the Details are lower or equal to the Roughness value? Take a look at the above renderings (rendered on the same machine and at the same size as before). Roughness again remains constant in this example (this time at a value of 100), but the Details are either equal to or below the Roughness value. This time we observe a noticeable visual difference with each step, as well as a render-speed increase. The lower the Details value goes, the more blurry the noise becomes, and the faster it renders.

Conclusion: Set Roughness carefully and only as high as you need it, then adjust your Details accordingly!

A final note: Always examine your noise detail in the context of image size! A noise that has been fine-tuned for a 600x600 pixel image might look awful when rendered at 2K resolution. On the other hand, a filter optimized for high-quality 4K output might still consume huge amounts of render-time when rendered at 600x600. If the internal noise detail has been set at the 4K level of detail, much of this detail will be wasted when the filter is rendered at low resolution and it will be awfully slow! Since users will want to render out filters at different sizes, filter authors should prepare their filters for this eventuality.

-- Crapadilla


Reverse-Engineering Noise Distortion

Image:Noise distortion reverse engineered 01.jpg

Noise Distortion is certainly a component that all texture filter authors worth their downloads should know intimately. Appearing rather inconspicuous when first encountered, this is a key component when it comes to understanding the principle behind 'distortions' and how they work within FF in general. Below, we shall take a closer look at this principle...

Image:Noise distortion reverse engineered 02.jpg

The image above shows the essential ingredients of a Filter Forge 'distortion', which is always based on the Offset component. Notice that the Offset component has its Offset H and Offset V inputs mapped with Perlin Noises, with each of the noises having a different Variation. The two noises provide the 'maps' according to which the pixels of the source image are 'offset' along the X and Y coordinate axes, resulting in a distortion visually equivalent to a real Noise Distortion. Also, note that the Percentage parameter of the Offset behaves exactly like the Distortion parameter on the Noise Distortion.

So, why is there a Noise Distortion component anyway, if we can 'reverse-engineeer' it like this?

Image:Noise distortion reverse engineered 03.jpg

Remember that it takes two Perlin Noises with different Variations to construct a Noise Distortion, which can become slow with high Roughness and Details settings. Even a workaround like the above - involving only one Perlin Noise and an additional Offset to 'fake' a second one - does not outperform a hard-coded component specifically optimized for the task. As Vladimir put it...

"[...] we're calculating two versions of the noise with the same seeds but with different offsets in the noise space (this doesn't require rebuilding the constant tables and therefore is faster than using different seeds)."

There you have it! The Noise Distortion component is as fast as it gets when it comes to natural-looking distortions. Be sure to use it!

Image:Noise distortion reverse engineered 04.jpg

So that part about 'reverse-engineering' was a bit exaggerated after all? Indeed. However, in the process of examining the inner workings of Noise Distortions, we have gained the understanding necessary to construct any distortion we can imagine! In the example above you can see a 'Worley Noise Distortion' based on Stones noises. Of course, one could use a different noise for each of the Offset H and Offset V inputs of the Offset component, use 'Pattern' components, or even something entirely different...

Distort away, all! ;)=)

For further studies on the subject of 'Worley Noise Distortions' see the following snippet:


-- Crapadilla


Personal tools