Help with anti-aliasing of PNG transparency issue

Sorry, but cant make a playground, as am not the actual developer, just trying to see if someone can help with a code fix, as this current implementation seems to mess up all the PNG textures.

the current code below should of solved the problem of jagged edges of transparent PNGs,

          const fixProductEdgePixelation = featureFlagStore.getFeatureFlagStatus(FEATURE_FLAG_NAMES.FIX_PRODUCT_EGDE_PIXLATION);
          if (fixProductEdgePixelation) {
            material.opacityTexture.updateSamplingMode(BABYLON.Texture.NEAREST_NEAREST);
          }

However, as you can see in the images attached, it does the opposite and screws up the whole PNG image.


the above is with the code shown,

And below is just with no code, just default setting.

Can anyone provide some help on what went wrong, or how to adjust the code?

Thank you and sorry if I am asking a simple question.

can you share the original image ?


hope this helps :slight_smile:

here you have an example as sprite :

DEFAULT_ANISOTROPIC_FILTERING_LEVEL is a value for the anisotropicFilteringLevel property, not for the sampling mode.

The values that can be passed to updateSamplingMode are the ones like BABYLON.Constants.TEXTURE_LINEAR_LINEAR or BABYLON.Constants.TEXTURE_BILINEAR_SAMPLINGMODE:

Ah thank you all very much, I have passed this one to our developer, have a lovely weekend all.

Hum? I’m also no dev. I’m a simple designer. Devs always think they will fix something inappropriate through some fancy post. I say: Give me a proper source and I can make it better. Give me a piece of st, and I’ll make it a piece of st with FX :grin:
Anyone ever thought of just making a proper source?
https://media-geneva.ch/demos/bjs/forum/cola-png-debug.html

EDIT: Quickly here below, your low resolution PNG (same as original).
I don’t wanna hear comments sayin ‘that’s because of the res’ :grinning: :face_with_hand_over_mouth: It isn’t!

https://media-geneva.ch/demos/bjs/forum/cola-png-debug-low.html

1 Like

Hi Everyone,

So I think there must be a bug in BB, I have tried to change the sampling in the sandbox.babylon.com but no options fixes the edge sampling.

and here is the original image,

And here is the original image loaded in photoshop, you can see how the edges are nice and smooth.

Can anyone shed any light on this? it was fine before in older BB versions.

Can you share a repro in the playground. The issue looks different and related to geometry aliasing not texture in your case.

Hi Seb, can you recommend anyone advanced enough to help us debug and fix this? not easy to create a playground thing at the moment! please DM me if you can

We can help if you provide a repro, but without it, it will be really hard to.