Sign in to follow this  
BoltBait

Feather Plugin (Now with Source)

Recommended Posts

This happens when the original object is already feathered.

Use my Adjustments > Transarency plugin to adjust the object to full opacity before running the feather.

Share this post


Link to post
Share on other sites

Object Feather 3.0 Released!

Download

Go download it here: BoltBait's Plugin Pack

What's Different?

So, what is different between the new version of Object Feather described in this article and the previous ones?

Well, let’s start with the fact that I have written 4 different versions of “feather.”

The first one, called Object Feather, used a blur to make the hard edges of cutouts blurred slightly in order to simulate an anti-alias effect. While it was nice for its time, it does produce less than perfect results. Plus, it was a nightmare to maintain as it was 335 lines of code.

The second, called Object Feather – True Feather, made the hard edges of cutouts slightly transparent. This was just a modification of the previous feather effect. It was better and well liked by the users of Paint.NET.

Both of these methods required the object to be feathered be surrounded by completely transparent pixels. This wasn’t a problem for most cutouts. The problem of these first two (which were contained within the same effect dll) was the fact that it didn’t work well at all for cutouts that were already feathered. To address that, I wrote:

The third feather effect, called Selection Feather, makes the hard edges of your current selection slightly transparent. This is how most other professional programs (like Corel PhotoPaint, for example) feather stuff. This is by far the most accurate of my plugins and it was only 50 lines of code. The only trouble with this one is that you need to have selected the object you want to feather. Feathering was then applied following the “marching ants” of your current selection. The effect applied was very similar to the True Feather option.

This is how things sat for a long time. People used all three of these effects depending on the need of their current situation.

While I liked the third feather effect, I was never really happy with my first and second effects. I had been thinking of a solution for that for a long time. Then, recently I wrote…

The fourth feather effect, called Object Feather 3.0, is the replacement for my first two feather effects. It basically uses the best of both the first and second techniques blended together. It uses a small blur to expand the objects like feather 1 and then applies the true blur algorithm like feather 2. I think that the results are far superior to Object Feather or True Feather. It also works on objects that are already feathered. And, another nice thing about this effect is that it is only about 20 lines of code so it is much easier to understand and maintain.

True Feather?

Now that I have officially replace Object Feather and True Feather with Object Feather 3.0, I’m sure that some will complain that True Feather doesn’t exist any more. Those people that still want a True Feather can use my Selection Feather effect instead. The only difference is that they will need to actually select what is to be feathered before running the effect. Other than that, it is the same.

Source Code

For the first time, I have decided to publish the source code. You will need CodeLab to build it into a plugin.

// Title: BoltBait's Feather Object v3.0
// Author: BoltBait
// Submenu: Object
// Name: Feather
// URL: http://www.BoltBait.com/pdn
#region UICode
int Amount1 = 2; // [1,10] Feather Radius
#endregion
unsafe void Render(Surface dst, Surface src, Rectangle rect)
{
   GaussianBlurEffect blurEffect = new GaussianBlurEffect();
   PropertyCollection bProps = blurEffect.CreatePropertyCollection();
   PropertyBasedEffectConfigToken bParameters = new PropertyBasedEffectConfigToken(bProps);
   bParameters.SetPropertyValue(GaussianBlurEffect.PropertyNames.Radius, Amount1);
   blurEffect.SetRenderInfo(bParameters, new RenderArgs(dst), new RenderArgs(src));
   blurEffect.Render(new Rectangle[1] {rect},0,1);
   for (int y = rect.Top; y < rect.Bottom; y++)
   {
       ColorBgra* srcPtr = src.GetPointAddressUnchecked(rect.Left, y);
       ColorBgra* dstPtr = dst.GetPointAddressUnchecked(rect.Left, y);
       for (int x = rect.Left; x < rect.Right; x++)
       {
           ColorBgra CurrentPixel = *srcPtr;
           ColorBgra DestPixel = *dstPtr;
           if (CurrentPixel.A != 0)
           {
               CurrentPixel.A = DestPixel.A;
               *dstPtr = CurrentPixel;
           }
           srcPtr++;
           dstPtr++;
       }
   }
}

Share this post


Link to post
Share on other sites

True Feather?

Now that I have officially replace Object Feather and True Feather with Object Feather 3.0, I’m sure that some will complain that True Feather doesn’t exist any more. Those people that still want a True Feather can use my Selection Feather effect instead. The only difference is that they will need to actually select what is to be feathered before running the effect. Other than that, it is the same.

Actually, it's not. Selecting the object puts an outline around it. That outline tends to obscure one's ability to see the preview of the feather effect. Sorry to seem unappreciative, but the functionality was much better before when it had the True Feather check box. I use this ALL THE TIME and I'm really disappointed by this change.

Share this post


Link to post
Share on other sites

Interesting. I believe this could be addressed by a change to the IndirectUI that our effects are written using.

Here is my suggestion to Rick:

Share this post


Link to post
Share on other sites

Another reason Feather Selection is not a good replacement for True Feather

is that Feather Selection tends to retain the jaggy selection edge in a way

that True Feather doesn't.

feathers01.png

Share this post


Link to post
Share on other sites

Here's what I see...

Click image to see full size:

post-44727-127137638739_thumb.png

(Zoomed in 300% to show detail.)

I think that True Feather needed an Effect Strength slider because the algorithm was not good. The Selection > Feather algorithm is much better as you can see in the above example.

You're showing an example of Feather Selection at radius 10. It was never meant to be used that high. The best results are in the 1-3 range.

It has been a long road for me to get these effects as accurate as they are now. I have tinkered with them for years. I believe that the latest updates that I have published are the best yet... when used correctly.

Share this post


Link to post
Share on other sites

I just had a new idea for a tweek to the selection feather algorithm... Checking it out now...

EDIT:

NewSelFeatherBeta.zip

eeew! Don't download this. :arrow-up:

Um... doesn't look that great. :/

Nevermind. :P

Share this post


Link to post
Share on other sites

Nope, no blur at all. It is all calculated manually.

Which is probably why it looks so bad...

Share this post


Link to post
Share on other sites

Hey BoltBait,

Is there any chance to download the old version of Object Feather? (With 2 Sliders and "True Feather" Option) ?

I liked the old one muuuch more :D

Edited by Frozen_byte

Share this post


Link to post
Share on other sites

Hey BoltBait,

Is there any chance to download the old version of Object Feather? (With 2 Sliders and "True Feather" Option) ?

I liked the old one muuuch more :D

No. Use Selection > Feather instead.

Read this:

Share this post


Link to post
Share on other sites

I don't have it any more.

Seriously, the old plugin had bugs. You just need to learn to use the new tools.

Share this post


Link to post
Share on other sites

The old plugin did have some bugs, but I did like being able to use the true feather function because when I tried to cut an object out of a backgrond with the magic wand tool, it would have little spots and hard edges around it, and if I used the true feather option, it would get rid of the spots and would make the object look smoother.

Share this post


Link to post
Share on other sites

I don't do Betas. Had too many bad experiences with them up to and including watching the BSOD on my screen. I'll wait for the RC version. In the meantime I'll try the suggestions given. Thanks much for the replies and stuff.

Share this post


Link to post
Share on other sites

Hello BoltBait,

First I would like to say that I love your set of plugins. I love working with Paint.NET because I don't have the spare time to learn to use photoshop. I'll leave that to the professionals.

I do have a question though. About this selection feather plugin, is there any way to increase the limit significantly from 10 pt? I'm currently working on a little high-resolution thingy for print, and when printed, the 10pt feather is barely visible. I'm looking for something atleast ten-fold.

I have looked through the source, but as far as I can see the Amount1 value gets lost in PropertyBasedEffectConfigToken and I've got no idea what it's doing after that.

With regards,

Share this post


Link to post
Share on other sites

Where do i find the old feather that comes with a True Color check box?... i have reinstalled my operating system and reinstalled paint.net, This feather doesn't look like the one i used to have. Please give me the link to the old one.

Thanks

Share this post


Link to post
Share on other sites

Where do i find the old feather that comes with a True Color check box?... i have reinstalled my operating system and reinstalled paint.net, This feather doesn't look like the one i used to have. Please give me the link to the old one.

Thanks

That one had "issues". It no longer exists.

For the same functionality, learn to use Selection Feather instead.

(For more information, read the posts at the top of this page.)

Share this post


Link to post
Share on other sites

Even though the old feather has issues I still find it produces better results for me. I have to use the eraser to touch up artifacts, but the current feather and feather selection either make the edges too blurry or still jagged and not feathered enough.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this