I’ve attempted to create two scenes with their associated cameras and display regions, which overlap one another, and to apply bloom on both of them. What happens is that the region with lower sort order gets obscured by the background of the region with higher sort order, although both have clear color deactivated. If I don’t try to set bloom effect, then regions are overlapped with transparency as expected. Panda 1.7.2. The test code:
from pandac.PandaModules import *
from direct.filter.CommonFilters import *
import direct.directbase.DirectStart
base.setBackgroundColor(0.2, 0.2, 0.2)
def make_scene (sort, clear_color,
light_color, light_hpr,
model_pos, model_hpr):
scene = NodePath("scene")
camera = base.makeCamera(
win=base.win, sort=sort,
clearDepth=True, clearColor=clear_color)
camera.reparentTo(scene)
light1 = AmbientLight("light1")
light1.setColor(light_color * 0.2)
light1np = NodePath(light1)
light1np.reparentTo(scene)
scene.setLight(light1np)
light2 = DirectionalLight("light2")
light2.setColor(light_color)
light2np = NodePath(light2)
light2np.reparentTo(scene)
light2np.setHpr(light_hpr)
scene.setLight(light2np)
model1 = loader.loadModel("cube")
model1.reparentTo(scene)
model1.setPos(model_pos)
model1.setHpr(model_hpr)
return scene, camera
scene1, camera1 = make_scene(
sort=1,
clear_color=Vec4(0.2, 0.1, 0.1, 1.0),
light_color=Vec4(1.0, 0.2, 0.1, 1.0),
light_hpr=Vec3(30, -30, 0),
model_pos=Point3(-2, 20, 2),
model_hpr=Vec3(60, 45, 0),
)
scene2, camera2 = make_scene(
sort=2,
clear_color=Vec4(0.1, 0.1, 0.2, 1.0),
light_color=Vec4(0.1, 0.2, 1.0, 1.0),
light_hpr=Vec3(30, -30, 0),
model_pos=Point3(2, 20, -2),
model_hpr=Vec3(45, 60, 0),
)
dispreg1 = camera1.node().getDisplayRegion(0)
dispreg1.setClearColorActive(False)
dispreg2 = camera2.node().getDisplayRegion(0)
dispreg2.setClearColorActive(False)
filters1 = CommonFilters(base.win, camera1)
filters1.setBloom()
filters1.setBloom(mintrigger=0.2, desat=0.0, size="large")
filters2 = CommonFilters(base.win, camera2)
filters2.setBloom()
filters2.setBloom(mintrigger=0.2, desat=0.0, size="large")
run()
In particular, the non-transparent background with bloom is black, although none of the set background colors are black (window background is gray, and clear colors for two created regions are dark red and dark blue).
Is this a bug or some sort of hardware/driver limitation, and what could be a workaround?