ZBrushCentral

Custom Filter (ZScript and Tutorial added)

Hey EZ, I believe the smoke in the Fire Ant image was done with the ColorSpray brush, and the fire was done with the Highlighter 2 brush, which differs from the original highlighter brush in that it only highlights up to the RGB value you set… :wink:

Thanks Cameyo. Just to add that, since many members seem to have Paint Shop Pro, there is a good description of how these filters work in the PSP manual (certainly since version 5 onwards).

There is information about these custom filter brushes at this thread as well http://www.pixolator.com/zbc-bin/ultimatebb.cgi?ubb=get_topic&f=1&t=007617

So that’s what highlighter 2 does! I did not know that. I tried it out, but it made everything so extremely white, apparently because I had my color set to white, which is as intense as you can get. Gotta try it over again now. Thanks, Miguel!

Thank you :warning: I also would welcome a zscript :warning: Excellent work :+1: :+1: :+1: :+1:

<a name=“filters”>TUTORIAL (and ZScript)
With this tutorial i’ll try to explain my experiment on Custom Filter tool. Sorry for any errors or wrong interpretation.
So what is a convolution filter ? Essentially, it’s a matrix, as follows:
0 0 0
0 1 0
0 0 0
The center cell in the matrix corresponds to the pixel that the filter will affect. The surrounding cells correspond to the pixels surrounding the target pixel.
The idea is that the pixel we are processing, and the eight that surround it, are each given a weight.
Convolution Matrix allow us to create simple custom filters. Convolution Matrix adds together the color values in the 3x3 (or 5x5) pixel box around each pixel, multiplying each pixel in the box by the corresponding value from the matrix.
The total value of the matrix is divided by a “FACTOR”, and optionally an “OFFSET” is added to the end value (I am unable to find these two values in ZBRUSH :frowning: :(, but,
with the AutoScale ON, the overall filter result will be factored to equal the specified Intensity value).
The matrix above is called an identity matrix, because the image is not changed by passing through it. Usually the “FACTOR” is the value derived from adding all the values in the matrix together, which ensures the end value will be in the range 0-255.
You can find more technical discussion of custom filter (User Defined Filter) in the PaintShopPro documentation, but here i want explain some rules of thumb instead of an equation.

To use a Custom Filter in ZBrush do the following:

  1. Select CustomFilter III Tool
  2. Open the Tool.Inventory palette
  3. Select a matrix and put the values on the slots (F00…F22))
  4. Paint over canvas
    To apply the filter paint over image use Dots, Freehand or DragRect as Stroke type.
    Try to modify the Intensity value, tha Autoscale and the Additive checkbox.
    The filter depends from RGB Intensity value and DrawSize value too.

What we’ll normally want to do is make sure that the sum of the values in all the cells in the matrix equals 1. This will ensure that the overall brightness of the filtered image is the same as the brightness of the original image. If the sum is less than 1, the filtered image will be darker than the original. If the sum is greater than 1, the filtered image will be brighter. Sometimes we want to make a filter to brighten or darken images. But keep in mind that if we stray too far from 1, we’ll get a filter that turns an image either entirely black or entirely white!

Unless otherwise compensated for, keep the matrix sum at 1 to retain the brightness of the original image.
To brighten an image, make the matrix sum greater than 1.
To darken an image, make the matrix sum less than 1.
Note: In other package we can compensate the filter effect with the FACTOR and OFFSET values.
Example: Sample Blur
These are a Sample Blur filter values
1 1 1
1 1 1
1 1 1
Notice that here the sum of the matrix is 9: there are nine cells with values of 1, and adding together those nine 1’s gives us a sum of 9. This sum is greater than 1 by a factor of 9, and we can compensate for that by making use of the FACTOR. By specifying a FACTOR of 9, we divide the sum of 9 by 9, which gives us a result of 1. And 1 is just what we need if we want the brightness of the original image to be maintained in the filtered image.
To compensate for a sum that deviates from 1, we must use a FACTOR equal to that sum to maintain the image brightness of the original image.
This will work whether the sum (and corresponding FACTOR) is a positive value or a negative value. We can also use the FACTOR to help adjust the brightness of filtered image, by using a value that only partially compensates for the sum’s deviation from 1.
To compensate for a sum that deviates from 1, use a FACTOR equal to that sum to maintain the image brightness of the original image.

WHERE IS “FACTOR” AND “OFFSET” IN ZBRUSH ?!?!?! I don’t know.

The Sample Blur filter also shows us how in general to get a blurring filter:
For a Blur filter, use a positive center value and surround it with a symmetrical pattern of other positive values.
Lessen the effect of a filter by increasing the value in the center cell.

Example: Sharpen
With the blur filters, we add to the matrix positive peripheral cell values around a positive central value. For a sharpening filter, we also use a positive central value, but this time surround the central cell with negative values.
For a Sharpen filter, use a positive center value and surround it with a symmetrical pattern of negative values.
-1 -1 -1
-1 9 -1
-1 -1 -1
Remember that in general we maintain the overall brightness of original image by using values in the matrix that sum to 1.

Example: Edge
For edge filters, the central value is what’s negative, with positive surrounding values.
For an edge filter, use a negative center value and surround it with a symmetrical pattern of positive values.
1 1 1
1 -7 1
1 1 1
We can lessen the effect of a filter by increasing the value in the center cell.

Example: Embossing
For an Embossing filter, use a positive center value and surround it in a symmetrical pattern of negative values on one side and positive values on the other.
1 1 -1
1 1 -1
1 -1 -1
Again, we can lessen the effect of a filter by increasing the value in the center cell (but we must compensate to mantain brightness).
1 1 -1
1 3 -1
1 -1 -1
We can adjust the direction of the embossing by repositioning the positive and negative cells that surround the center cell. For example the following values emboos to top:
1 1 1
0 1 0
-1 -1 -1

Here is a small collection of Matrices to experiment with filter. They are mainly just to get you started. The way that the convolve works, is that it applies the matrix that you supply to every pixel in the image. The middle square represents the weight of the current pixel. The squares around it represent the weight of the surrounding pixels.

LINE DETECTION
Detection of one pixel wide lines can accomplished with the following filters;
Horizontal Edge
-1 -1 -1
2 2 2
-1 -1 -1
Vertical Edge
-1 2 -1
-1 2 -1
-1 2 -1
Left Diagonal Edge
2 -1 -1
-1 2 -1
-1 -1 2
Right Diagonal Edge
-1 -1 2
-1 2 -1
2 -1 -1

POINT DETECTION
The Point detecters detect discontinuities in the image… (non smooth areas)
-1 2 -1
-1 2 -1
-1 2 -1

GRADIENT DETECTION
Changes in value over 3 pixels can be detected using kernels called Gradient Masks or Prewitt Masks. these filters enhance the edges in various directions. The direction of the change from darker to lighter is described by the following matrixone of the points of the compass. The 3x3 kernels are as follows:
Embossing North
-1 -2 -1
0 0 0
1 2 1
Embossing West
-1 0 1
-2 0 2
-1 0 1
Embossing East
1 0 -1
2 0 -2
1 0 -1
Embossing South
1 2 1
0 0 0
-1 -2 -1
Embossing NorhtEast
0 -1 -2
1 0 -1
2 1 0
Embossing NorhtWest
-2 -1 0
-1 0 1
0 1 2
Embossing SudEst
2 1 0
1 0 -1
0 -1 -2
Embossing SudWest
0 1 2
-1 0 1
-2 -1 0

SMOOTHING AND BLURRING
Smoothing and blurring operations are low-pass spatial filters. They reduce or eliminate high-frequency aspects of an image.
Arithmetic Mean
The arithmetic mean simply takes an average of the pixels in the kernel. Each element in the filter is equal to 1 divided by the total number of elements in the filter. Thus the 3x3 arithmetic mean filter is:
1/9 1/9 1/9
1/9 1/9 1/9
1/9 1/9 1/9
Basic Smooth 3x3 (Blur) (not normalized)
1 2 1
2 4 2
1 2 1
Basic Smooth 5x5 (not normalized)
1 1 1 1 1
1 4 4 4 1
1 4 12 4 1
1 4 4 4 1
1 1 1 1 1

HIGH-PASS FILTERS
A high-pass filter enhances the high-frequency parts of an image. This type of filter is used to sharpen images.
Basic High-Pass Filter (Sharpen) 3x3
-1 -1 -1
-1 9 -1
-1 -1 -1
Basic High-Pass Filter: 5x5
0 -1 -1 -1 0
-1 2 -4 2 -1
-1 -4 13 -4 -1
-1 2 -4 2 -1
0 -1 -1 -1 0

LAPLACIAN FILTER
The Laplacian is used to enhance discontinuities (changes in the image).
The 3x3 kernel is:
0 -1 0
-1 4 -1
0 -1 0
The 5x5 kernel is:
1 1 1 1 1
1 1 1 1 1
1 1 24 1 1
1 1 1 1 1
1 1 1 1 1

SOBEL FILTER
The Sobel filter consists of two kernels which detect horizontal and vertical changes in an image. If both are applied to an image, the results can by used to compute the magnitude and direction of the edges in the image.
Horizontal Sobel
-1 -2 -1
0 0 0
1 2 1
Vertical Sobel
-1 0 -1
-2 0 2
-1 0 1

=============================================
Here is some more filters:

Edge Detection - Heavy
1 -2 1
-2 4 -2
1 -2 1

Edge Detection - Medium
-1 -1 -1
-1 8 -1
-1 -1 -1

Edge Detection - Light
0 1 0
1 4 1
0 1 0

Emboss Filter
-1 0 0
0 0 0
0 0 1

Enhance Detail
0 -1 0
-1 10 -1
0 -1 0

Enhance Edges
-1 -1 -1
-1 9 -1
-1 -1 -1

Enhance focus
-1 0 -1
0 7 0
-1 0 -1

Reduce jaggies
0 0 -1 0 0
0 0 3 0 0
-1 3 7 3 -1
0 0 3 0 0
0 0 -1 0 0

Soften Filter - Heavy
11 11 11
11 11 11
11 11 11

Soften Filter - Medium
10 10 10
10 20 10
10 10 10

Soften Filter - Light
6 12 6
12 25 12
6 12 6

Blur - Light
1 2 1
2 2 2
1 2 1

In the ZScript i have collected some more filters (see image): try it and experiment with your values.

ZScript: CustomFilter.TXT

Demo Image:

Happy ZBrushing

cameyo

p.s. Thank You Mentat7 to start the first topic on custom filter.

And for the math lover artist you have crazzy result when the filter is applied without temporary matrix.
The matrix function go pixol to the other pixol (pixel out Zbrush :slight_smile: in a sort of fractal procedure before the entiere filter will be finished on the nine slot !
It’s the same filters but with a sort of inverse retro-pedalling :slight_smile:
It’s not clear ? Yes :slight_smile: but it’s computer arts :slight_smile:
And in anotherway matrix apply is the Game of Life invent by John H Conway
You find the best free programm and start links for the fantastic Game of life here http://www.winlife32.com/ only for PC users
sorry for Apple people :frowning:
But here everybody can play as a “god creator” with a very speedy Applet !!! http://www.math.com/students/wonders/life/life.html
The Author of this crazzy programm is Alan Hensel and if you are interest how a modest genius make masterpiece of tricky speedy result go there http://hensel.lifepatterns.net/lifeapplet.html
But CAREFUL it’s more ADDICT than ZBRUSH !!!
If life interest you, all is on the Web !
Crazzy community too :slight_smile:
Have good matrix aventures
Pilou

Thanks for the comprehensive rundown on filters, whew I had no idea! Definitely printing this one out for reference. Thanks for taking the time to write this.

going to check out the script now

P.S. They work like a champ!

thank you :+1:
that helped me to better understand it Plus a Handy little Tool :+1:

Thanx C! I’ll be checking this out later today, and this looks very interesting for experimenting!

:sunglasses: :+1: :+1: :+1: :+1: :sunglasses:

mucho appreciated, cameyo!!! as there is no wish-list- forum online at the given moment i’ll put a very big wish of mine right here: i hope there’ll be a customfilterpack like the materialpack available soon! these effects look fantastico and i’d love to be able to apply them inhouse zbrush :+1: :+1: :+1: :+1: :+1: and so on!

  • juandel

Cameyo:

I don’t know if this is the case, but couldn’t an existing “brush tool”, such as the glow brush, be made more aggressive with these filters? I love the functions of the glow brush, but simply cannot get enough “strength” out of them. Now a brush that combined some of the features of a low intensity “smudge” brush and a high intensity “glow” brush would be just the ticket. Do you think the custom filter brushes could produce something like this? If you think so, do you know where to begin?

Thank you very much,

Bruce Gregory

Hi Bruce,

Have you tried to increase the Sample Size in the tool modifiers? I think that will make a difference for you. :slight_smile:

Aurick:

The sample size does help, but doesn’t accomplish exactly what I need. For example, a low poly mesh with some unwanted angular detail or any ridgelike projections that are a result of low polygon modeling, are still left behind, untouched by the power of the glow brush alone. However, if afterward, you select the gentle spherical alpha and the smudge brush with a setting around 1, you can minimalize these unwanted protrusions.

What would really be swell, would be a way to automate this proceedure with a “combo” brush that does both things and, as in a layered situation, would only “brush” the model, never straying from the bounds of the model, which is isolated on its own layer, and, thus, not produce those unwanted halos of color or of black around the edges of the deposited model. (I think most people are using the glow brush in this capacity - to remove unwanted seams and wrinkles). Does this make any sense, and if so, do you have any answers?

Thanks for being interested,

Bruce Gregory

To avoid affecting anything that doesn’t have pixols already, simply turn off ZADD in the Draw palette.

I use the blur and smudge brushes a lot for fixing things – but much of it is not done until after baking or after re-importing the image for postrender work.

I doubt you’ll find any single tool that does it all for you. Just too many variables, and too many desired effects that people might have a desire for.

Aurick:

What do you mean when you say “something that doesn’t have pixols already.” Doesn’t everything have pixols once it is snapshot into the canvas?

I guess your answer to my question is that the custom filter brushes can’t be used to imitate a combination of both of these brushes (the blur brush and the glow brush), and that they could not be automated so that they do not affect anything except the actual pixols in the layer in question, or, that it’s a waste of time to try to make this happen? Do I understand you correctly?

Thank you for your reply,

Bruce Gregory

No,no,no and No!!!

I realy think that the Zfilters are not enought easy to use!!! :frowning: :mad:
You must try a lot of settings to obtain some results…
Let see for automatical Zfilters.You can change after to obtain the exact result you want.

For automatical exemples like:
-Blur filter.
-Hightlight filter.
-Noisy filter.
Etc…etc…

These tools are too powerfull.So users want them more easy to understand and use.

Thanks to Cameyo for his work on zfilters. :wink:

ron harris sent me a pic of him self here it is with camyo filter

and here it was but i tweeked it in another program.

you could allmost put that face on a dollar bill LOL well ummmm :rolleyes: maybe a Quarter he he snikers BAWHAHAHA.
OR would make one heck of a nice Head stone when time comes :wink:

lol EZ, dohhhhhhh…you couldnt fit my fat head on a quarter…(not that i am worth a quarter coz you would have to get change back on that) thnx for the smile EZ… :stuck_out_tongue: :stuck_out_tongue: :stuck_out_tongue: :stuck_out_tongue: :stuck_out_tongue:

Cameyo, thank you! that is incredibly comprehensive :+1: – I had just found a simple edge-detection matrix on the web and checked this thread to see if it was already mentioned, but of course it was :slight_smile:

I think I will have to type in some of those numbers and save some nice filter tools

For custom filter III brush:

1 1 1
1 -8 1
1 1 1

I used it on the creature below (which is on its own layer) and it added some nice surface detail (it would have been better if I had just applied it here and there instead of all over, but I won’t bother the server with an image update)