Filter Construction: Surface Filters

From Filter Forge Wiki

Revision as of 10:59, 13 August 2008; view current revision
←Older revision | Newer revision→
Jump to: navigation, search

Contents


This chapter of The DOs and DON'Ts of Filter Construction discusses techniques for successfully braving the Heights!

Creating correct bump maps (or height maps)

Image:goodbumpmap.gif

When assembling a gray scale image for Height input in the Result component (in a Surface type filter) make sure the darkest pixels approach black and the lightest pixels approach white. Afterwards scale to the desired height using the Surface height slider from the Lighting tab.
Of course you can ignore all this and make a height map that is almost even gray and still have a great looking output. But if you intend the filter to be used for rendering 'Bump maps' you better take this approach. Bump maps have a 0-255 range so you'd be a fool not to use them all.
A good way to tune your final height maps and prevent clipping is described here.

-- Sjeiti


Separating the Subtrees

Or why you need to properly keep apart the branches of your Filter tree!

Image:Filter Tree Branch Separation 01.gif

"Separating branches? Subtrees? Filter trees? To hell with that, I'm not a gardener!"

In contrast to Simple type filters, which posess only a single Source map input, Surface type filters posess five distinct map inputs: Surface Color, Height, Reflectivity, Reflection Blur and Metallic. (For more info, see Result and Render Maps). In the following, the term Filter Tree "branch" (sometimes also called a "subtree") refers to a part of the Filter Tree that is connected to one of these five map inputs.

All Surface filters require their Height map input to be connected, and all Simple filters must have a Source connected, which means there will always be at least one Filter Tree branch connected to the Result component. For Surface filters however, a Filter Tree could - theoretically - consist of five completely independent (i.e. not interconnected) branches, one connected to each map input of the Result component. In reality however, this is rarely the case...

In the example above, it is obvious how one and the same branch can be connected to both the Surface Color and Height map inputs. The Desaturate component has been inserted to visually demonstrate the image information that the Height map input actually "sees" from the colored Bricks component output: an averaged grayscale image! So, one would wonder, what is the problem with this kind of construction?

Image:Filter Tree Branch Separation 02.gif

Let's change the bricks color control to a different color, a light gray for example. Notice that - in addition to the desired change at the Surface Color input - the height information that the Height map input "sees" has also changed, and quite drastically! This behaviour would also occur if any of the parameter values of the hue, luminosity and saturation control sliders were changed.

Why is this bad? The user may just have wanted to change the color of the Diffuse Map, but because of the way the filter is constructed, his tweak has also affected the height information, thus changing the Bump Map as well. This is completely undesirable, because a color tweak should be just that: a change in color! Also remember that any changes to the height map also influence reflections and surface lighting. Consequently, a small color tweak like the one above could - with the wrong filter construction - have drastic impact on the look of a filter, and drive a user mad with frustration.

Image:Filter Tree Branch Separation 03.gif

What do we do to remedy this? We construct the filter as two separated branches so that any change on the Surface Color branch leaves the Height branch unaffected! In the modified example above, the user can tweak colors all day long, but the height map would never change. This is what the user expects, and this is how it should be!

Image:Filter Tree Branch Separation 04.gif

Instead of completely separating the branches, you could also construct the filter in such a way that the color map is generated from (or after) the height map. This is often an elegant solution, since a change to the height map practically always means a change of the diffuse map as well, but rarely the other way around.

Conclusion: Always make sure to properly separate color from height, so that user tweaks to one branch do not introduce unwanted changes in the other branch! This separation should always be considered for the lesser side-branches (Reflectivity, Reflection Blur and Metallic) as well.

Image:Filter_Tree_Branch_Separation_05.GIF

Let us study some library filters with properly constructed separation between the branches and notice how the Height branches are usually the backbones (i.e. the main branches) of Surface type filters. The side-branches, namely Surface Color (and Reflectivity, Reflection Blur and Metallic, if present), are usually 'generated' from these main Height branches. This type of filter construction has the advantage that any changes to the Height branch affect a filter 'globally' and ripple 'upstream' to any side-branches present, while any changes to the smaller side-branches affect a filter only 'locally'.

The image above shows a part of the Filter Tree of the Rough Plastering filter. Note how the tiny color "branch" is constructed at the very end of the filter, right before everything is fed into the Result component. The Diffuse Map is generated via a Blend component set to Luminosity Mode: the height map (Foreground input) modulates the luminosity of a solid color field (Background input), darkening the recesses and brightening the relief. This simulates dirt, wear as well as ambient shadowing and serves to exaggerate the depth of the texture.

Image:Filter_Tree_Branch_Separation_06.GIF

Our next example has been taken from the Slate Flooring filter. In this case the Diffuse Map has been generated via an Elevation Gradient, which is another very useful technique. Again, the color "branch" is only a small part at the very root of the Filter Tree, while the main branch is solely dedicated to generating the height map.

Tip: Take a look at the filter internals and notice how all the components of the main branch have been purposely constrained to grayscale values. This is generally a good habit to adopt, as it increases Filter Tree readability by visually identifying "branch affiliation" of components and - more importantly - greatly facilitates the evaluation of height information.

Image:Filter_Tree_Branch_Separation_07.GIF

Another example (this time from the Decadent Drapery filter). At first glance it looks like there are two equally complex branches being developed in parallel (with various interconnections), but upon closer examination (notice the ratio of grayscale to color on the components) it is obvious that - again - the Height branch is the backbone of the whole Filter Tree, and the small Surface Color branch is generated just right before the final result.

On a side-note: Take a look at the control components and their positions in the Filter Tree hierarchy. Some controls - when changed - would 'invalidate' large portions of the Filter Tree, forcing the majority of components to re-render. Notice that all controls for making drastic changes to the look of the filter are located on the far-out limbs of Height tree, while the controls for Surface Color are located near its root (i.e. the Result component). Consequently the color controls only force a very small part of the Filter Tree to re-render when tweaked, and are very interactive for this very reason.

Image:Filter_Tree_Branch_Separation_08.GIF

We'll come to a close with an example from the Unstable Weave filter. Here, a Blend component is used to tint the height map (Background input) with a solid color (Foreground input) using the Mode 'Color' in combination with an Opacity mask. As you can see, there exist an abundance of methods for generating color maps from height maps, and we have just explored the most basic in this dicourse. The same principles and methods can - and should - be applied to generate specularity maps and other map types as well.

Crapadilla says: "Happy Filter Tree Gardening, y'all!" ;)

-- Crapadilla


Personal tools