Anomalies with bloom filter

I have found two strange things that I consider as… anomalies or potential bugs:

  • bloom filter doesn’t work with render.setShaderAuto();
  • bloom disables antialiasing.
    Since I don’t use shader generator often, I am not sure why this happens.
    Here is the code sample, tested on ATI X1600 (driver 9.3) with Panda 1.6.0:
from direct.filter.CommonFilters import CommonFilters
from direct.gui.DirectGui import OnscreenText
from pandac.PandaModules import *
import sys

loadPrcFileData("", "framebuffer-multisample 1")
loadPrcFileData("", "multisamples 2")

import direct.directbase.DirectStart

base.setBackgroundColor(0, 0, 0.1)

# instructions
def addInstructions(pos, msg):
    return OnscreenText(text=msg, style=1, fg=(1,1,1,1), mayChange=1,
                        pos=(-1, pos), align=TextNode.ALeft, scale = .05,
                        shadow=(0,0,0,1), shadowOffset=(0.1,0.1))
inst1 = addInstructions(0.95, "1 : toggle interval (currently OFF)")
inst2 = addInstructions(0.90, "2 : toggle shader generator (currently OFF)")
inst3 = addInstructions(0.85, "3 : toggle bloom (currently OFF)")
inst4 = addInstructions(0.80, "Escape : exit")

model = loader.loadModel("box")

# hpr interval
ival = model.hprInterval(30, Point3(360, 0, 0))
def toggleIval():
    global ival
    if ival.isPlaying():
        inst1.setText("1 : toggle interval (currently OFF)")
        inst1.setText("1 : toggle interval (currently ON)")
base.accept("1", toggleIval)

# shader generator
autoshader_on = False
def toggleShaderGen():
    global autoshader_on
    if autoshader_on:
        inst2.setText("2 : toggle shader generator (currently OFF)")
        inst2.setText("2 : toggle shader generator (currently ON)")
    autoshader_on = not autoshader_on
base.accept("2", toggleShaderGen)

# bloom
filters = CommonFilters(,
bloom_on = False
def toggleBloom():
    global bloom_on
    if bloom_on:
        inst3.setText("3 : toggle bloom (currently OFF)")
        filters.setBloom(blend=(0, 0, 0, 1),
        inst3.setText("3 : toggle bloom (currently ON)")
    bloom_on = not bloom_on
base.accept("3", toggleBloom)

# camera, -10, 10)

base.accept("escape", sys.exit)

Nah. A real bloom filter only applies bloom to specular colors. The bloom filter can only know where there are speculars by asking the ShaderGenerator. If this is not enabled, it will start guessing where the speculars are (in this case obviously wrongly).
So, you should enable some specular color or glow maps on the model, I’m sure that will fix it.

As for the question about antialiasing, I think it’s because you called render.setAntialias - this does not apply to the quad the CommonFilters is rendering into.
Try enabling antialiasing with cf.finalQuad.setAntialias.
Arguably, a bug in panda because it doesn’t automatically do this when render has antialias enabled - but this would be hard to implement correctly.
(this is just a theory, I’m not sure if I’m actually correct about this.)

Thank you, pro-rsoft!

It didn’t work though… Antialiasing doesn’t work with bloom :frowning:

Same for me in 1.7.0.
(GF9600GT, Kubuntu, lastest propertiary drivers)

framebuffer-multisample #t
multisamples 4



gives good result (both images are scaled im gimp with filters turned off):
now adding:

filters = CommonFilters(,
filters.setBloom(intensity = 1.0, size = "medium")

and this is result:

also filters.finalQuad.setAntialias(AntialiasAttrib.MAuto) doesn’t change anything.

I’ve noticed the same behaviour. v1.7.0 Mac, bot-built late February.

In my Config:

framebuffer-multisample #t
multisamples 16

AA always on:


With 0 intensity Bloom on:

self.postprod = CommonFilters(,
self.postprod.setBloom(blend=(0.5,0.5,0.5,0.0), mintrigger=0.99, maxtrigger=1.0, desat=0.0, intensity=0.0, size="small") # 1.75

I get a aliased picture, 640x480 doubled in size, pixel repetition:

With Bloom off AA is on: