Enabling bloom on selected nodepaths only

Hi,

According to some (older) posts the following should work, but it doesn’t do what I expected it to do. I want to enable glow/bloom, but not on the whole scene. If I understand correctly, I can enable filters/auto shading on my whole scene, and use bitmasking to select which filters setAutoShader() applies.

        filters = CommonFilters(base.win, base.cam)
        filters.setBloom()
        render.setShaderAuto(BitMask32.allOn() & ~BitMask32.bit(Shader.BitAutoShaderGlow))

This should enable all shading, except for glow/bloom. I would then, further down the tree, enable glow for a certain nodepath. But the above still applies bloom/glow to my whole scene… What am I doing wrong?

Thanks

Are you looking for bloom or are you looking for glow? These are two different – although similar – effects.

For bloom, you blur the highlights of the scene and mix that blurred image back in. Bloom is entirely screenspace and the only way to avoid it affecting models is to render the models after the fullscreen quad used for the bloom effect.

For glow, you do a render pass with only glow maps (i.e., no diffuse, specular, etc.). That render pass is then blurred and mixed into the main render pass.

1 Like

Ow… I did not realize bloom and glow were different things. Documentation is a bit scarce, I find, so I mixed them up because they seem to be doing the same thing. I will look what I can find on glow maps, that seem to be the thing I need then (make only a laser beam glow).

Thanks!

If you want to make a laser beam glow, an old-fashioned but potentially-effective approach might be to apply a texture that fades to black, and then make the model blend additively. This can result in the impression of a “glowing light”.

1 Like

That’s actually a really nice and effective solution, I hadn’t thought of that. Easy to handle and less impact on performance, I’m guessing. Thank you!

1 Like

The bloom filter in Panda implements both bloom and glow. The difference is in how you configure it. To use glow, you need to set the blend factor to use the alpha channel only, and configure the shader generator to write glow maps to the framebuffer alpha channel.

1 Like

So, I got a basic version of Thaumaturge suggestion working quite well. I appreciate the other insights and explanations, but this might be the simplest way for me to implement a simple glow on a single laser beam. I am still trying to figure out one little thing though, hopefully you can help me with that too.

In the picture, the laser is show from above, and it looks fine. It’s a blended texture on a CardMaker card that I scale. Rotation is done automatically from the parent nodepath, that uses .headsUp(). Problem is, it’s a flat card. My first guess was to use a billboard effect, so that the card always faces the camera (and is always the same width), but none of the default effects or even an customized effect seems to do the trick (probably because my rotating laser makes facing the camera difficult if not impossible).

Any ideas on how to make my rotating laser and freely movable camera should be setup to render the same from every direction angle? The length of the laser should remain dynamic (i.e. stops when hitting a target, not yet shown in the image).

If the camera can tilt down, to look along the laser, then it could be tricky to prevent its flatness being visible under all circumstances.

In that case, since you’re using additive blending, you might be able to get away with just extending your laser-geometry a bit: Ad a second quad to the laser much like the first but oriented vertically instead of horizontally, and a third quad at the base that’s square and shows a circular image, the latter intended to handle the case of the laser being viewed end-on.

On the other hand, if the camera simply rotates around the vertical axis, then I think that you can use an “axial billboard” effect via NodePath’s “setBillboardAxis” method. However, looking at the API I see that it rotates around the up-axis. So, what might be called for is to set up your laser such that it actually points upwards, then pitch it down to be horizontal again: that should result in its “up”-axis pointing “forwards”, which may cause the billboard effect to work as expected.

Alternatively, I think that MeshDrawer’s “segment” method might produce the sort of billboarding that you’re looking for, if I understand you correctly. It’s a little more work than your current setup, I imagine, but may be worth it.

1 Like

Thank you. The setup I have now only has a horizontal plane, and my camera moves freely on the X- and Y-axis. The only time the laser seems to be a bit flat is when the camera is moved away from it. I think your suggestion of adding a second plane might just do the trick!

1 Like

+1 for pointing me in the direction of MeshDrawer, that seems like something I want to explore more and might come in handy in other areas as well.

1 Like

MeshDrawer really is quite a handy thing at times. :slight_smile:

1 Like