Can't change base background after simplepbr.init()

This code produces a red screen like you’d expect:

import simplepbr
from direct.showbase.ShowBase import ShowBase
from direct.showbase import ShowBaseGlobal


class Interface(ShowBase):
    def __init__(self):
        super().__init__(self)
        ShowBaseGlobal.base.setBackgroundColor(1, 0, 0)
        simplepbr.init(enable_shadows=True)


Interface().run()

But when I change the order of ShowBaseGlobal.base.setBackgroundColor(1, 0, 0) and simplepbr.init(enable_shadows=True), it shows the default gray screen:

import simplepbr
from direct.showbase.ShowBase import ShowBase
from direct.showbase import ShowBaseGlobal


class Interface(ShowBase):
    def __init__(self):
        super().__init__(self)
        simplepbr.init(enable_shadows=True)
        ShowBaseGlobal.base.setBackgroundColor(1, 0, 0)


Interface().run()

I’m curious why this happens and if I can avoid it. If this is unintended, I’m happy to open an issue @Moguri

Possibly a bug in Panda, issue filed. Workaround is available in this issue:

1 Like