BloomFilter troubles

I’m using a bloom filter to create a nice halo around objects which have glow maps. This effect worked perfectly when I was doing render.setShaderAuto() but I had to change that when I implemented a cube map for my sky dome. I have all the objects with glow maps parented, ultimately, to one node that is a child of render and I am calling setShaderAuto() on that node.

When I made this change, the bloomFilter stopped using the glow maps to determine what gets a halo and what doesn’t. Now anything that’s bright does, and the things with glow maps hardly get any halo at all.

I have the blend setting for my bloomFilter at (0,0,0,1) as the manual instructs, but I’m definately not getting the result I should. What should I do?

I’m using panda 1.6.2, btw.

I resolved the initial problem by going back to render.setShaderAuto() and calling setShaderOff() on my sky sphere.

The only problem I have now is that the bloom is screwing with my sky sphere. Is there a way to make the bloom ignore it?

Will Panda3D 1.7.0 resolve the problem of not being able to do texture manipulation (pos, scale, cubemaps, etc) when the auto shader is turned on?

Edit: I tried using the mintrigger parameter of the bloom filter, but that didn’t do anything. :frowning:

So setShaderOff() works for you? Are you by any chance still using 1.6.2?

And what do you mean by texture manipulation? I can animate an UV when it is enabled (in 1.7.0).

I mean setTextureOffset() etc. I’m using 1.6.2. The only thing I’ve found to reduce the bloom filter altering the sky sphere (which has setShaderOff() called on it) is to lower it’s alpha with TransparencyAttrib.MAlpha.

I think you can do that by disabling alpha-write (check out ColorWriteAttrib).

Yes, the Shader Generator supports these things in 1.7.0.

Like this?

bits = ColorWriteAttrib.CRed
bits |= ColorWriteAttrib.CGreen
bits |= ColorWriteAttrib.CBlue

skydome.setAttrib(ColorWriteAttrib.make(bits))

Or CRgb, which is CRed | CGreen | CBlue indeed.

Nah, same for me.
EDIT: No wait, it works… on the Glow-Filter-Basic demo, the model on that has glow texture assigned.

Another idea would be to use a separate display region for the skydome and reparent the camera for that display region to base.cam

About using another display region…
Something like a skydome is always rendered behind everything else, so

from direct.directbase.DirectStart import *
from pandac.PandaModules import *
from direct.actor.Actor import Actor
from direct.filter.CommonFilters import CommonFilters

base.cam.setPos(0, -30, 5)


# a model in the default display region
panda = Actor('panda.egg', {'walk' : 'panda-walk.egg'})
panda.loop('walk')
panda.reparentTo(render)

# create 2nd display region
dr2 = base.win.makeDisplayRegion(0, 1, 0, 1)
dr2.setSort(-1) # ordering of display regions

# You will also need to clear the depth or Z buffer. 
# This buffer is used to determine which objects are in front of other objects,
# and if you fail to clear it, some objects may not draw. -Manual
base.win.setClearDepthActive(True)
base.win.setClearDepth(1.0)

# 2nd camera for 2nd display region
render2 = NodePath('render2')
cam2 = render2.attachNewNode(Camera('cam2'))
dr2.setCamera(cam2)

# 2nd camera inherits base.camera transforms
def cameraTask(task):
	cam2.setPos(base.camera.getPos())
	cam2.setHpr(base.camera.getHpr())
	return task.cont

taskMgr.add(cameraTask, 'cameraTask')

# 2nd model for 2nd display region
env = loader.loadModel('environment.egg')
env.reparentTo(render2)
env.setScale(0.4)
env.setPos(0,0,-0.2)

# a filter on 2nd display region only
filters = CommonFilters(base.win, cam2)
filters.setBloom(mintrigger = 0.1, intensity = 3.0, size = 'Large')

# Can't apply filters on default display region...
# filters2 = CommonFilters(base.win, base.cam)
# filters2.setBloom(mintrigger = 0.1, intensity = 3.0, size = 'Large')


run()

I probably forgot something obvious?

skydome.setAlphaScale(0) is simpler.

Right, it may be a bit slower, but it’s indeed simpler.

Shorter form of my version:

skydome.setAttrib(ColorWriteAttrib.make(ColorWriteAttrib.CRgb))