Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Make Skybox Transparent in Filament? #8333

Closed
p147123456 opened this issue Jan 2, 2025 · 1 comment
Closed

How to Make Skybox Transparent in Filament? #8333

p147123456 opened this issue Jan 2, 2025 · 1 comment

Comments

@p147123456
Copy link

p147123456 commented Jan 2, 2025

I'm trying to make the Skybox transparent in Filament, but so far none of the methods I've tried have worked. Here's what I've attempted:

Setting the 's clear options to transparent:Renderer

private void makeTransparentBackground() {
    this.setZOrderOnTop(true);
    this.getHolder().setFormat(PixelFormat.TRANSLUCENT);
    this.setBackgroundColor(Color.TRANSPARENT);
    modelViewer.getView().setBlendMode(com.google.android.filament.View.BlendMode.TRANSLUCENT);
   modelViewer.getScene().setSkybox(null);
    Renderer.ClearOptions options = renderer.getClearOptions();
    options.clear = true;
    options.clearColor[0] = 0.0f; // Red
    options.clearColor[1] = 0.0f; // Green
    options.clearColor[2] = 0.0f; // Blue
    options.clearColor[3] = 0.0f; // Alpha
    renderer.setClearOptions(options);
}
modelViewer.getScene().setSkybox(
    new Skybox.Builder().color(0f, 0.0f, 0.0f, 0.0f).build(modelViewer.getEngine())
);

Neither approach has worked. The background remains black. I’ve also ensured that:

The is set to .SurfaceViewPixelFormat.TRANSLUCENT
The background color is set to .SurfaceViewColor.TRANSPARENT
The alpha channel is .Renderer.ClearOptions.clearColor0.0f
What is the correct way to make the Skybox transparent in Filament?

@romainguy
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants