Transparent offscreen rendering panel

I have a offscreen scene that is rendered into a texture that is used as background in a lemur Panel using QuadBackgroundComponent. I would like to have only the rendered object on this panel, the rest should be transparent. I thought setting the alpha to 0 of the ViewPort, but it didn’t change anything:

_view.setBackgroundColor(new ColorRGBA(0, 0, 0, 0));

I have not skybox and nothing apart from the model in the offscreen scene and the background gets actually drawn (checked it by changing it to red).

Any quick hint, what I need to change that this works?

Not sure exactly what your problem might be but maybe you can take a look at how I did the tree atlas in SimArboreal Editor:

It renders the trees to an offscreen buffer that it uses as a texture… and definitely takes advantage of transparent background else the trees would all look like strange rectangles. :slight_smile:

Maybe it’s enough to spot what I did differently.

Thx - its working now. It was because my offscreen still had a FXAAFilter attached to it, that caused the issue.

Hmm - I still have an issue here. And maybe someone has a hint :wink:

As written before, I removed the FXAAFilter from the offscreen view. Since doing this, the background is transparent, great! But some parts of my model are now transparent as well. There are two materials on this model, both are pbr. One has the BaseColor set to a color, and this is displayed correctly (opaque). But the other one uses the BaseColorMap with a texture and its completely transparent. First I thought its about some alpha values of the texture, so I replaced it with a generated one using ImageRaster with an imageFormat Image.Format.RGBA8 and only the color ColorRGBA.Blue to ensure no bad alpha values, but it didn’t change a thing.

I am pretty sure I am doing something wrong and I know its hard to give any hints without having a testcase, but maybe someone has some direction nevertheless.

@Nehon: Its somehow PBR related, so maybe you have an idea?

Edit: If I enable the FXAAFilter again, I get a completely fine “blue” model - but then the background is black instead of transparent again…

does your scene render correctly onscreen (rather than rendered offscreen) ?

I have had issues that sound similar with transparent objects that are not placed in the Transparent Bucket rendering incorrectly.

Hmm, actually never tried it without the FXAAFilter. But I just now did a small test and when its onscreen there are no issues with the materials…

Gotcha! I think I’ve found a bug in the PBR shader.

@Nehon: Please verify

My problem was fixed after setting the Color for BaseColor in addition to the BaseColorMap. I am not 100% sure but I think its because the shader takes the color information from the map, but the alpha gets multiplied by the basecolor anyway which results in 0 if there is no BaseColor set:

float alpha = Color.a * albedo.a;


Color = m_BaseColor;

I am sure about the fix, but not about the reason - someone with deeper shader knowledge should have a look into it, but might be a good catch;)

oh… might be a bug indeed
Will fix this.

Ok, let me know when its in master, then I can test it

It’s in.
It also fixed another issue where alpha was multiplied by itself if you used the BaseColor.

Have also tested the fix and its working now without additionally setting the baseColor. Thx!