Edge Fringing on Alpha Edges in Texture Maps

Needle groups on this tree are an image map applied to a surface.
One image for colour/Image as below:

And a silhouette of the same image to control transparency:

There is minor fringing around the needles in the image above, which in this closeup isn’t a problem as a proportion of the opaque parts. At least it wouldn’t be if it stayed that proportion. BUt the below shows that the proportion of the fringe-size-to-needle-size increases greatly when zoomed out from the tree. I understand this can be from how the application or the display card is calcularing the transition from transparent to opaque. My experience getting rid of similair artifacting in a 2d bitmap animation programming had to do with an alpha “Pre-multiply” setting. Maybe there’s something similair in Rhino. THoughts welcome.

Hello - is there an alpha channel on the image or is it using color masking? Can you post the image you are using?

-Pascal

There are the two images, an image for colour and a sillhouette of the same image for transparency.
But they’re .tif files and I can’t upload them.

If you have a grayscale texture in the Transparent slot you should make sure it is one according luminance. The grayscale values are slightly different weighted than ‘regular’ grayscale.

edit:

I’d guess your current transparency texture is created based on lightness (also known as relative luminance)

Red*0.2126 + Green*0.7152 + Blue*0.0722

Whereas you should have one based on (perceived) luminance

Red*0.2989 + Green*0.5870 + Blue*0.1140

This object is from a 3d model vendor so I don’t know how it was converted to grayscale, so I made another sillhouette (a jpg this time) according to the above formula (which my default image editor uses). No difference.

I made a jpg of the colour image too, to eliminate the .tif factor (I hope) and no luck. I will upload the images below. I uploaded the entire object at the bottom of this post.

I was thinking this is a display rendering issue rather than bitmap-related - because otherwise (it seems to me) the problem would alias away to nothing with a zoom out, whereas this gets more pronounced with zooming.

Colour Masking isn’t checked for either image.

If I derive the transparency map by grading the colour image to a sillhouette in the Transparency image editor, the issue is just the same.

The images:


The Project:
BishopsPIneCL13y.3dm (8.6 MB)

The second post in this thread seems belevable to me. What do you think?:
https://answers.unity.com/questions/10302/messy-alpha-problem-white-around-edges.html

Hello - there is an advanced options setting for controlling mipmapping - I don’t know what the modes signify nor if it’s a good idea to play in here but it appears the default is 2 - I guess I’d try 0 and 1 and see what that does.

Options > Advanced > type in mipmap in the filter at the top and look for
Rhino.Options.OpenGL.MipmapMode

-Pascal

If you have an original TIFF with the alpha channel in it I’d use that instead of the transparency texture.

I created a quick version of the texture in GIMP. Note that I didn’t do a super-good job, as there are alpha gradients in the object itself, but this should be good enough to illustrate the technique

With that in the color slot, the transparency slot disabled, but with the advanced setting Alpha Transparency checked I get:

Your original transparency mask is not high enough quality, there’s lots of blocky bits, and when used as mask there are lots of very bright pixels in the plant bits. These more or less cause the edge fringing you experience.

edit: here a sample of the blocky and hard edges of your original textures, put on black to highlight the artifacts.

image

deleted

That results in a significant improvement, thanks. (I suppose mipmapping is set to 2 for a reason, and I wonder if I would pay elsewhere for the adjustment.)

But the white fringing is still there washing out the slim dark needles the further away one zooms. I’ve shrunk the matte a little, I"ve created a matte that’s black with empty spots for the needles, but the edges always graduate to white before becoming 100%, and the tree looks more frosted the more zoomed out. , I’m not sure how to implement what’s recommended in the link I posted beyond what I’m trying here.

Yours have no such artifacts, I take it…

Every time I’ve tried I have those white artifacts. Saving out from my image editing programme (I was a beta tester for tv paint so I use that, but they are all more or less the same) when making titles for superimposing on video, I’ve always achieved clean edges by choosing premultiplication. WIth this pipeline I can’t get it clean.

Note that the PNG I posted has also transparency in the needles, because I was lazy and did just a quick hack. You’ll have to adapt the alpha channel so that the needles and twigs look better.

Just put the PNG on a black background and you’ll see what I mean :slight_smile:

I will have to try that later. But I may have got what I need at this point.

I can report that “advance transparency” may be what some other apps call “premultiplication”. It’s removing whiteness in the areas graduating to transparent and making a big difference again.

Even still, there is a pattern that builds up and works its way into the needles from the edges as one zooms. It’s minor, but it’s there.

However, advanced transparency, mipmapping, and using - as you suggested - the original coloured tiff (which unlike the sillhouette provided does have an alpha channel) results in an acceptable enough improvement despite the accretions from zooming.

Thanks!