2

I'm following this tutorial for Filament: https://medium.com/@philiprideout/getting-started-with-filament-on-android-d10b16f0ec67

How do I set the background color to white?

override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        surfaceView = SurfaceView(this).apply {
            setContentView(this)
        }
        choreographer = Choreographer.getInstance()
        modelViewer = ModelViewer(surfaceView)
        surfaceView.setOnTouchListener(modelViewer)

        loadGlb("DamagedHelmet")

        modelViewer.scene.skybox = Skybox.Builder().build(modelViewer.engine)
        loadEnvironment("venetian_crossroads_2k")

    }

I've tried setting background color on the SurfaceView but that didn't work.

Currently, it looks like this (seems like the default is black):

VIN
  • 6,385
  • 7
  • 38
  • 77

1 Answers1

2

I figured it out. I need to set the skybox color.

For instance, this sets the color to red.

modelViewer.view.blendMode = com.google.android.filament.View.BlendMode.OPAQUE
modelViewer.scene.skybox = Skybox.Builder().color(0.81f, 0f, 0f, 0f).build(modelViewer.engine)
VIN
  • 6,385
  • 7
  • 38
  • 77
  • I tried to remove the skybox by '''scene.skybox = null''' but that makes a weird glitch. setting a pure color skybox did the trick. thanks! – wdanxna Jul 15 '22 at 06:56