Jump to content

diffuseTexture with alpha channel has edge artifacts on iOS?


jps0611
 Share

Recommended Posts

Ok the last thing I can think of is alpha premultiplication while loading the png on ios.

Basically it looks like the border:

image.png.2b1235a7ebfff4cd251d8f9977b9287e.png

has the alpha premultiplied at load time by ios on webgl: https://webglfundamentals.org/webgl/lessons/webgl-and-alpha.html

If it is the case it would be an unfortunate ios bug ? to prevent any texture rsizing and so on, could we also check that the size is a power of two ?

 

Link to comment
Share on other sites

1 hour ago, Pryme8 said:

I swear it has to do with the transparent pxls being held as pure black with no alpha being mixed at the edges to the semi transparent ones.

Is this something that needs to be addressed in BJS? Or something I can change in the way I'm exporting my assets?

Link to comment
Share on other sites

I'm pretty sure there is a setting somewhere we can adjust.  
Let me do some testing, and research I am almost sure I've fixed this in the past with Deltas help on one of my projects.

I'm pretty sure this came up as well when I was doing ping-pong buffers for simulations where it would corrupt my simulations by setting a pixel to an alpha 0 cause inherently to turn black... its an interesting behavior but I think its there to save memory, cause why hold a bunch of byte data for something you wont see, I get it... its just F&*(@#$! annoying.

Give me a little bit, I have a busy day and should prolly not even be on here right now but luckly I'm waiting on someone for a second so I had a moment.

Link to comment
Share on other sites

@jps0611, I had a bit more time to work on this issue.

It seems that the mip map generated for ios have black info on the neighbors transparent pixels hence the darken colors. Disabling Mips completely is solving it: https://playground.babylonjs.com/#U6F7E2#6

At the drawback of Quality obviously but it is already progress meaning only the inerpolation with full transparent pixel looks like broken on ios.

 

Link to comment
Share on other sites

@jps0611 I did a quick test displaying the image without alpha:

https://playground.babylonjs.com/#U6F7E2#9

and yes it looks like on IOS every transparent pixel has been lost like on IE so when the filtering is turned on you get some black mixed in the cat creating the border.

Let me see if there is any setup we can tweak but if it is like IE, this would be a browser issue without workaround except changing the texture format for something less compressed ?.

image.thumb.png.e518ee6062f98a6da37c6a5d11e7afde.png

Link to comment
Share on other sites

So even trying to force the alpha unpremultiply does not work on safari:

https://playground.babylonjs.com/#U6F7E2#11

Whereas we can see it working on Chrome by turning the feature off:

https://playground.babylonjs.com/#U6F7E2#10

@jps0611 unfortunately there is nothing we can do at the Babylon level for this, You can contact the Safari team to report the issue and in the mean time you could try to use another format for your picture in webgl.

Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

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.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...