Selectively omit objects from a Pass


I’ve been trying to create a filter of my own, based on mostly the same ideas as the BloomFilter. However, I would like to be able to choose which objects should be bloom’d, and at what time. The only solution that I see to do this right now with the current BloomFilter is to swap the material of the geometries that shouldn’t be bloomed with a same version of the material that doesn’t have the glow technique, copying the parameters, etc., which is slow; or to set their glow color to black, in which case they are still rendered in the extraction pass needlessly, which is also slow.

So I dug a bit deeper and I saw that the extraction pass used a method called “setForcedTechnique”, which makes the RenderManager only render geometries with materials that have this technique. Because techniques can’t be added and removed at runtime, I would need to use another way to get the RenderManager to ignore certain geometries. This could be done with a user-set flag with setuserData, or with a certain parameter name on the material that the RenderManager would check before rendering.

This way, geometries could be included or excluded from the bloom pass easily at runtime.

Or is there an easier way?