CodePlexProject Hosting for Open Source Software

In these days, while I'm researching the Hardness parameter of Paintbrush tool in PS, I found that the circle painted by Paintbrush tool directly is different from the circle shape defined by path, shown as below:

Both are circles in radius of 100 pixels. The left one is drawn by shape layer and filled by gradient color; the right one is painted directly by brush in the hardness of 0%.

We can see that the right circle looks like a little bit larger than the left one. Unlike the right one that has a very smooth gradient transition, there is a noticeable sharp edge around the left one. It seems that what the hardness gradient of Paintbrush in PS uses is not just a simple linear gradient. For more accurate analytics, I checked the actual color in different radius, and marked on every 10% of the radius length. The following picture shows what I got:

Starting from the top most line that representing 100% pure black, every line downside means a reduction of 10%, until the bottom line that is 0% (pure white). We can now sure about that the gradient used for brushtip rendering is not linear, and its radius actually expands to 160 pixels, which is a half more than the specified radius of 100 pixels. The color at the radius of 100 pixels is about 10% (where the last second line marks on the right).

The really surprising thing to me is that even the most simple gradient fill in PS is still not linear. We can see this from the distribution of the lines in the left figure above. It always uses non-linear algorithm which is wider at the both side and narrower in the middle.

Using non-linear gradient is to match the character of human's mental feeling. The users' perception or their drawing is the most important, not the mathematical accuracy. For better explanation to the non-linear changes, I painted the following curves:

The left curve is simpler and seems more linear, although non-linear correction is also applied. It can be fitted by a simple cubic curve. While the curvature of the right one is higher, and cannot be fitted by a single cubic curve, but it seems to be able to be fitted by two curves joined at the midpoint (50% position).

Furthermore, the size ratio of the gradient part and solid part, and the actual size are also different for the brushes with different hardness. And the changing is also non-linear. The following figure represents the trend from 0% to 100%.

The top line shows the edge of the solid parts, which is pure black from the center to the edge; while the bottom line shows the actual size of the brush tips. We can see that these two lines are also a little bit non-linear. (Perhaps this is the most linear situation in PS.)

Both are circles in radius of 100 pixels. The left one is drawn by shape layer and filled by gradient color; the right one is painted directly by brush in the hardness of 0%.

We can see that the right circle looks like a little bit larger than the left one. Unlike the right one that has a very smooth gradient transition, there is a noticeable sharp edge around the left one. It seems that what the hardness gradient of Paintbrush in PS uses is not just a simple linear gradient. For more accurate analytics, I checked the actual color in different radius, and marked on every 10% of the radius length. The following picture shows what I got:

Starting from the top most line that representing 100% pure black, every line downside means a reduction of 10%, until the bottom line that is 0% (pure white). We can now sure about that the gradient used for brushtip rendering is not linear, and its radius actually expands to 160 pixels, which is a half more than the specified radius of 100 pixels. The color at the radius of 100 pixels is about 10% (where the last second line marks on the right).

The really surprising thing to me is that even the most simple gradient fill in PS is still not linear. We can see this from the distribution of the lines in the left figure above. It always uses non-linear algorithm which is wider at the both side and narrower in the middle.

Using non-linear gradient is to match the character of human's mental feeling. The users' perception or their drawing is the most important, not the mathematical accuracy. For better explanation to the non-linear changes, I painted the following curves:

The left curve is simpler and seems more linear, although non-linear correction is also applied. It can be fitted by a simple cubic curve. While the curvature of the right one is higher, and cannot be fitted by a single cubic curve, but it seems to be able to be fitted by two curves joined at the midpoint (50% position).

Furthermore, the size ratio of the gradient part and solid part, and the actual size are also different for the brushes with different hardness. And the changing is also non-linear. The following figure represents the trend from 0% to 100%.

The top line shows the edge of the solid parts, which is pure black from the center to the edge; while the bottom line shows the actual size of the brush tips. We can see that these two lines are also a little bit non-linear. (Perhaps this is the most linear situation in PS.)

Last edited Jul 1, 2010 at 5:58 AM by richardbao2000, version 1