nmfisher / flutter_filament

3D rendering layer for Flutter/Filament
Other
44 stars 7 forks source link

Transparent background #17

Closed Hannnes1 closed 2 months ago

Hannnes1 commented 2 months ago

First off, this is a really cool package, and I have looked for a 3D viewer that isn't web based for a long time. There is one thing that I'm wondering about though.

Is it possible to make the background transparent? I.e. so that widgets placed below the viewport (in a Stack for example) is visible. When reading through the README I get the impression that it is possible, but I couldn't figure out how when playing around with the example app.

Thank you!

nmfisher commented 2 months ago

Thanks for your interest. This isn't possible on web or Windows[0], but should work fine on MacOS/iOS/Android.

Here's a quick test I just did on MacOS (on develop branch, sorry I haven't merged into master for a while):

Screenshot 2024-02-22 at 10 26 59 PM

The green box with HELLO is a Flutter widget composed underneath the viewport. I called setBackgroundColor with a partially transparent color then setBackgroundImage.

If it's not working on iOS or Android, then that's a bug that I need to fix.

[0] we need to use Texture widgets to do this. Last time I checked, these weren't supported on web yet. For Windows, this requires the ANGLE driver which I did implement and does work, but with some odd rendering artifacts and poor performance. If I ever get time, I'll dig into this deeper to investigate.

Hannnes1 commented 2 months ago

Great, thank you!

Side note: I might have a few other questions that might not be suitable for an issue.

If you are okay with that, is there another channel that is more suitable for questions? Or should I create new issues?

nmfisher commented 2 months ago

No problem, you can just submit new issues so other people can find the information in future too.