Reputation: 3345
I'm using Qt3D with a combination of this offscreen renderer and modified the framegraph to include a background image, like here.
Unfortunately, adding transparency to the objects drawn over the background image using QPhongAlphaMaterial
only works unsatisfactorily.
This is th result:
What you can't see here is that the whole circle part is actually transparent, i.e. the renderer wrote the transparency value of the object for the whole pixel instead of adding it transparently on top of the background.
This is what the rendered object looks like wihtout transparency:
And this is the background:
The framegraph has two branches: one for the backgroun image, which is processed first, and one for the objects. I added a QRenderStateSet
for the objects that contains a QBlendEquation
with the blend function set to add and a QBlendEquationArguments
with source RGB and alpha set to 1, and destination RGB and alpha set to 1 minus source alpha.
Any ideas how to fix this problem?
(For anyone wondering, I took the images from the T-Less dataset and wrote a program to create ground-truth data for 6D pose estimation)
Upvotes: 3
Views: 727
Reputation: 3345
Similarly to this question, the format of the texture that is being rendered to needs to be set to RGB8_UNorm
and not RGBA8_UNorm
, i.e. without the alpha channel.
Upvotes: 1