Filter Construction: Seamless Tiling

From Filter Forge Wiki

Jump to: navigation, search

Contents


This chapter of The DOs and DON'Ts of Filter Construction discusses Seamless Tiling, this beautiful yet fragile thing, and shows how to handle it with the proper care!

Be sure to study the help articles on Seamless Tiling, Size and Discrete Filters as a technical primer for this section.

The Case against Frame Components

A popular tell-tale sign of sloppy filter construction is 'broken' Seamless Tiling, or - more correctly - a faulty reaction to the Size control slider, which effectively breaks filter output and renders it useless. This occurs when components that react to the global Size parameter (i.e. those that tile/repeat) are carelessly mixed with those that are unaffected by Size (i.e. those that do not tile/repeat). Currently, there exist several components which are 'non-tiling' by nature, the most infamous being the Frame component. It is this very component that often is the cause for seamless tiling problems, as we shall see below.

Image:Case against frame components 01.GIF

In the example above, two Profile Gradients are used in conjunction with a Frame component to construct the head of a screw. While the result appears to be technically sound at first, it breaks as soon as the Size, pixels control is used. The Profile Gradients tile (i.e. they are affected by Size) but the Frame component does not (i.e. it is unaffected by Size). The result? Certainly not an Editor's Pick! ;)

Image:Case against frame components 02.GIF

So how do we go about fixing this? Simple: If we replace the Frame component with a component that is affected by the Size parameter, such as Tiles, the seamless tiling via Size works correctly again! What do we learn from this? Always use Frame components with discretion!

Remember that Size is a global parameter hard-wired to every filter. It is integral to seamless tiling, it cannot be disabled, and it does not go away, no matter how many big red "Don't touch that damned Size slider, you ยง$%&" stickers you slap onto your filters. Consequently, it makes a lot of sense to get into the habit of constructing filters in ways that correctly utilize the Size, pixels control.

The following components are considered discrete:


Components not affected by Size are:


"Yeah ok, but now you totally screwed up my filter! I want one screw-head, not four, or sixteen!" some might object. Well, that's a valid objection and a demand quite possible to satisfy. However, let us save this for a later discourse. ;)

-- Crapadilla


Odd-numbered Tiling

Image:Odd numbered tilings 01.gif

"What the... !? Why can't I get a single tile out of this?"

Has it occurred to you that natively the Pattern components only support even-numbered tilings? The example above shows three Tiles components with their Repeat H and Repeat V parameters set to 1/1, 2/2 and 3/3 respectively, resulting in tilings of 2x2, 4x4 and 6x6. With Repeat H and Repeat V set to 1/1 we get a tiling of 2x2 as the smallest tiling possible on a Tiles component!

But what if we wanted just 1 tile, or a tiling of 3x3, or 9x9? And what if we wanted our filter to be able to go through all available square tilings, starting from 1x1 and continuing with 2x2, 3x3, 4x4, 5x5, and so forth?! It would appear the Pattern components are somewhat lacking an option to accommodate for anything else than their hard-wired 'divisable by two' tiling behaviour.

Image:Odd numbered tilings 02.jpg

Or so it would seem! As demonstrated with the filter above, odd-numbered tilings are indeed possible with Pattern components. Below we shall examine the methods with which these were achieved.

Image:Odd numbered tilings 03.gif

The first method to achieve odd-numbered tiling utilizes a Kaleidoscope component, which has been set up like this:

Mode: Square
Offset H: 0
Offset V: 0
Shape Size: 25
Repeat H: 1
Repeat V: 1


Displayed on the left side is the filter tree at a Size of 100% (equivalent to a Repeat value of 1), on the right at a Size of 25% (equivalent to a Repeat value of 3). Using the the Size control slider we can seamlessly move through all possible tilings starting from a single tile. So far so good! But what happened to the color variation on our Tiles component? Apparently, it got lost in the operation. Looks like this method is only suitable for patterns without color variation!

[For more info on Kaleidoscopes, check the excellent Kaleidoscopes Unveiled article.]

Image:Odd numbered tilings 04.gif

So here we go. This method utilizes Offsets and Profile Gradients. The original red color tile is first offset to the exact center of the image and subsequently scaled to 200% of its original size. The image above shows the filter tree at a Size of 100% (equivalent to a Repeat value of 1). Component settings for the two Offsets are the following:

Offset 1:
Offset H: 25
Offset V: 25
Percentage: 100


Offset 2:
Offset H: Mapped with Profile Gradient
Offset V: Mapped with Profile Gradient
Percentage: 25


Image:Odd numbered tilings 05.gif

The same filter tree at a Size of 25% (equivalent to a Repeat value of 3). The result is assembled by 'sampling' every second 'tile' of the original Tiles component, a reasonable compromise that allows for preserving the original color variation. Note that with this method, all controls of the Tiles component remain completely usable, except for Chaos, which must be kept at a value of zero due to the offset scaling. In effect, we have created a new Tiles component capable of seamlessly running through all possible square tilings.

Check out the filter used for this article: Odd-numbered_Tilings.ffxml

Library filters that use this technique:


Happy Tiling!

-- Crapadilla


Personal tools