Gimp-Forum.net
Prevent bleeding when Gaussian blurring a selection? - Printable Version

+- Gimp-Forum.net (https://www.gimp-forum.net)
+-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP)
+--- Forum: General questions (https://www.gimp-forum.net/Forum-General-questions)
+--- Thread: Prevent bleeding when Gaussian blurring a selection? (/Thread-Prevent-bleeding-when-Gaussian-blurring-a-selection)



Prevent bleeding when Gaussian blurring a selection? - KevKiev - 08-14-2018

I can't seem to apply Gaussian blur to a selection without colours from surrounding pixels (but outside the selection area) bleeding in. 

I read about selective G blurring, but that doesn't seem to fit what I want to do.  Median blurring was ineffective for what I was trying to do.

I googled around and found others with the same problem, but no solutions. Is there a setting or something I'm missing to prevent bleeding like this?


RE: Prevent bleeding when Gaussian blurring a selection? - rich2005 - 08-15-2018

Could you give context on what you are blurring. For example selecting a foreground (person, object) and blurring the background. Your interest seems to be games, so not sure how blurring applies.

If you need sharp-edges to a selection the selection tools have an anti-alias toggle normally on. Turn it off.

Other methods involve copying the selection to a new, transparent layer, Alpha-lock the layer before blurring. Also use of a layermask to provide the hard-edge might be possible.


RE: Prevent bleeding when Gaussian blurring a selection? - KevKiev - 08-15-2018

Thanks for the reply.

I was doing some final tweaks to a normal map for a game object, a radio, smoothing out the colour transition in a small area within the borders of the 4 numbers in this image (there are colour differences from left to right and up and down between the numbers):

[Image: GAMce9A.jpg]

I broke the area down into 8 different sections and applied the gradient tool to each one, which helped a lot.   After applying gradients, the colour differences were almost invisible on the texture except under zoom, and actually unnoticeable in-game except in one particular lighting condition - when the sun is shining just a touch from just a bit in front of directly to the side (hope that made sense). 

i.e. in 99% of conditions, the radio looks similar to this:
[Image: jB3wBge.jpg]

but in that one lighting condition, the shadows result in a sharp horizontal line in the particular area I mentioned, like so:

[Image: xsuZYC8.jpg]

Which corresponds exactly to a barely-visible seam in that location on the normal.  (At first I thought it was the specular map.)  Considering that the flaw is visible only in in such relatively rare instances, and only when the player is viewing the radio very close in, I'm not set on getting it perfect but just want to minimize it as much as I can. 

It seemed to me that Gaussian blur was the perfect tool for this purpose.  My initial selection included the pixels bordering right up against the outer portions of the 4 "fins" that surround the area, which contain all sorts of bright colours.  The result was indeed a smoothing out of the shadow transition, but the bleeding from the fins caused a noticeable loss in visual quality in those areas so was just trading one problem for another.

I got it pretty darn close to what I wanted simply by reducing the selection area so it was far enough away from the fins.  I appreciate the tips though, I may well go back and see if they'll help.  I certainly never thought of turning off anti-aliasing as I've always associated AA as producing sharp edges.  Although, granted, my knowledge of AA is pretty rudimentary, i.e. in gaming, you crank up the AA for sharper images and turn it dow for better performance but lower visual quality.


RE: Prevent bleeding when Gaussian blurring a selection? - rich2005 - 08-15-2018

Throwing one of the procedures into the hat - no idea if it works inside a game engine.

Use a path to define the selection. Path to selection. Copy the selection. https://i.imgur.com/LVQePTR.jpg

Edit -> Paste As -> New Layer In Place. Gets a new layer of the area. Lock the alpha channel and gaussian blur. https://i.imgur.com/aI6VCPr.jpg

Check before merging layers https://i.imgur.com/tDrfFkt.jpg


RE: Prevent bleeding when Gaussian blurring a selection? - KevKiev - 08-15-2018

Hmmn... that actually sounds like a great idea. My biggest hurdle in Gimp is not knowing all the available tools, and you've just added a few to my toolbox. I think I have my original selection saved as a channel somewhere so I can go from there. Thanks!


RE: Prevent bleeding when Gaussian blurring a selection? - KevKiev - 08-16-2018

Well, I think I screwed up somewhere along the line as when I pasted as new layer in place the selection went white (very odd 'cuz it worked fine on a trial run just messin' about). But, in any event, I simply edited the selection on a separate layer with the alpha locked, gaussian blurred the heck out of it, then merged it back into the normal map. I think that made things about as close to perfect as possible, since even proper Gimp techniques can't overcome the limitations of a game engine. But, yeah, that alpha lock tip was the key. Thanks very much!