Problems with transparency in PNG

Hi.

I recognized in the past that transparency could lead to problems with displaying materials when there is a texture in PNG format with transparent areas included.

The ground material is made of a PNG with transparent borders to receive a smooth transition between the grass plane and the background image mapped on a sphere.

I also had this kind of problem when I gave a little transparency (opacity below 1) for the sphere with the mapped environment.

In this case, the grass plane with the PNG also makes the material of the blue object, which is not 100% opaque, invisible.

This is because Shapespark uses order depended approach when rendering transparent objects. Objects in the back should be rendered before objects in front for correct result, but such order is not always possible to establish correctly (for example, if grass object surrounds the whole building). In your case, blue object is incorrectly renderer before the grass, which causes the problem.

Is it important for the blue color of the blue object to be partially transparent? If the blue color was fully opaque, and the holes in the object fully transparent, the problem should disappear.

Hi Jan,

It is not necessary. But it shows a problem with which I frequently have to deal. If we cannot control the order of the objects to be rendered, it is always gambling.

If the grass or a sphere surrounds the building the sorting will not work correctly, because it uses objects bounding spheres to determine the order. The grass could be divided into several objects, to ensure the bounding sphere doesn’t enclose the whole scene, but it could be difficult to divide the sky sphere.

Could you upload this scene and send us a link? I would like to test one solution that should manually enforce the correct order.

You can find the scene here: https://buildav.shapespark.com/vs_afriso/

The sky is divided into 4 objects, and the objects no fully sphere objects.

This problem is fixed if you reduce, even by a very small value, an `Opacity’ setting of the grass texture.

The reason for this is that majority of transparent PNGs in Shapespark scenes are ‘cutout’ textures, that either have fully opaque or fully transparent pixels (plants most often have such cutout textures). Cutout textures are easier to deal with and are always handled correctly by the rendering algorithm. Shapespark assumes PNGs are cutout and makes some additional optimization that produce the sorting related artifacts that you have encountered with the PNG which is not a cutout texture.

Reducing opacity has a side effect of making PNG for sure not a cutout texture and disables the optimizations that are the cause of the problems.

Thank you @jan, I will give it a try.