Bug #361

Transparency issue with overlapping objects

Added by Andrew Varga about 2 years ago.

Status:NewStart date:06/03/2016
Priority:NormalDue date:
Assignee:-% Done:


Target version:-


I attached a simple scene where this problem can be seen isolated.

The setup is that there is a painting on the wall which has 3 materials: a simple diffuse for the frame, and 2 masked materials for the the actual painting.
These mask materials use 2 different png images by fetching the opacity from the alpha channel of the png images. One of these images is the background of the painting and uses a blue diffuse material, and the other is the human figure which is currently set to a diffuse red color.
The reason I use this setup is that like this I can easily change these 2 colors by just changing the diffuse color in the xml without touching the png textures.

The problem can be seen in the resulted rendering: scene.png. Instead of a blue background for the painting the background is black.

In the fixed version (scene_fixed.xml, scene_fixed.png) the only difference is that the scene uses a modified obj model (assets/painting/item_fixed.obj), where that overlapping plane is pushed slightly outwards (the last 6 vertices have their z coordinates modified from -2.5 to -2.4).
This results in a correct rendering with blue background and red figure but this is a hack and I suspect this may be a bug worth looking at?
The problem only occurs if the triangles with the masked materials are overlapping. It works correctly when either of the 2 planes are moved inwards/outwards so they don't collide witch each other.
For some reason when they overlap, the transparent part adds black pixels when it should let the other material show up.

If I could get some pointers where to look in the source code that could help too!


transparency_issue.zip (418 KB) Andrew Varga, 06/03/2016 03:33 pm

Also available in: Atom PDF