Glow effect on single nodepath

I’m trying to create a glow effect when I select a piece in a 3d board game I’m making. I looked at the bloom filter, but that looks like it puts a glow on everything.

You can tell the bloom filter to only make a certain object glow by using model.setShaderAuto() instead of render.setShaderAuto(). The glow can then be turned off using model.setShaderOff()

Yes, but wouldn’t that make it so that the models that aren’t glowing wouldn’t have any shadows? That is very undesirable.

You’re right, the only thing I can think of to get around that would be to write a custom glow shader that could be applied separately. And that is not necessarily the best option, unless you know how to write your own shaders (which I personally don’t know how to do).

Just use a glowmap on every single node.

Thanks, but, a bit of example code maybe? I’m still a Panda noob.

I think somethink like this:

def loadModel(modelpath, useglow = False):
	model = loader.loadModel(modelpath)
	if useglow == False:
		texture = loader.loadTexture('black.png') # a tiny black image
		ts = TextureStage('ts')
		model.setTexture(ts, texture)
	return model

It would be nice if there was a method in Panda to do this automatically, like


or something, put there isn’t

That functionality does exist, and is in CVS (CMU added it a while ago). Pass a BitMask32 to set_shader_auto indicating which effects you want to enable or disable on that node.

Awesome, but can you post some example code? I’ve really no idea how to get this to work.

To disable glow, but enable everything else:

node.setShaderAuto(BitMask32.allOn() & ~BitMask32.bit(Shader.BitAutoShaderGlow))

To only enable normal mapping and shadow receiving:

node.setShaderAuto(BitMask32.bit(Shader.BitAutoShaderNormal) | BitMask32.bit(Shader.BitAutoShaderShadow))

The API is weird, but there you go.

this doesnt work for me though:

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

filters = CommonFilters(,
filters.setBloom(size = "large")

base.setBackgroundColor(0,0,0,1) # bug?

panda = loader.loadModel('panda')
panda.setPos(0, 30, -8)

render.setShaderAuto(BitMask32.allOn() & ~BitMask32.bit(Shader.BitAutoShaderGlow))


What do you mean, “doesnt work”? Could you be a bit more descriptive, tell us what happened and what you expected to happen?

When I try to run the code, it crashes and I get the following error:

AttributeError: type object 'libpanda.Shader' has no attribute 'BitAutoShaderGlow'

That’s because this feature is on the CVS trunk; it’s too new for the 1.7.x release. You’ll have to install the buildbot release to get access to this feature.

I get the same error with 1.8.0.

It’s exactly this: if that is supposed to disable glow, then I still see glow.

A bit off-topic, but… if it ever gets official could I ask for a more sane interface? Like:

SetShaderAuto(int NormalMapping=true, int Glow=true, int Shadows=true … )

I wrote a pair of shaders that give objects a glow around their outer edges. It’s based on the advanced cartoon shading sample program. One shader colors the selected object(s) solid red (255, 0, 0), and the resulting texture is applied to a full screen TextureCard. The TextureCard has a second shader that performs Sobel edge detection. The result is depicted below. If you’re interested, I can give you the shaders and set-up code.

Wow, that looks like exactly what I need ken! Could you post a working example so I can figure it out?

Hm, it is? I don’t think you could get that effect with the built-in or any glow shader. It looks like an outline shader to me, still a useful shader, but different.
Is that a level editor?