Hello. In my game, images are dynamically loaded from the server, and in order to avoid a black background of transparency in png files, I use this code
material.diffuseMap = texture
material.opacityMap = texture
material.blendType = 'alpha'
material.alphaToCoverage = true
alphaToCoverage property is only supported by webGL2.0, so in the instagram browser, the background is black instead of transparency. I have an idea to calculate the average color and replace the black background with the average color, but I can’t understand whether it is possible to change this black background at all. Tell me how this is done.
I was getting the same issue. I don’t know whether it will be resolved using the average color value logic.
I did that by changing the blend type to alpha and changing the color channel to A instead of R and it fixed the issue without using the alphaToCoverage Property.
That’s how my material settings look:
And that’s what I do in code
Hope that helps.
Thanks. It really works. But I found such an artifact, the transparency of some elements is darkened, but I have not yet found the reason for this. I wonder if it is possible to change the black color of the opacity fill?
Can you share an example project with a test asset to look at please?