Proposal: Multiple Forced Techniques

I’m running into a problem while trying to create some specific filters. I’d like to determine exactly where a particular geometry is occluded, so I can do special effects on either the occluded or un-occluded sections. However, if I create a special technique for a particular material that supports the effect, other materials don’t necessarily have this technique, so they don’t get rendered at all, and therefore don’t occlude anything.

BloomFilter also suffers from this. If a user creates a material without a glow technique, glow is visible through that material.

The only solution I could come up with (besides requiring every matdef to have a truckload of techniques) is modifying the render manager to support a stack of forced techniques, instead of only one. If a material does not have the first forced technique, it will try the next one in the stack.

Now, if each material definition were given a “black” technique (rendering completely black, with vertex effects), filters like BloomFilter could set the forced technique stack to {glow, black}. Then materials that do not have a glow technique will fall back on the black technique and still occlude whatever glow is behind them.

What do you all think?

2 Likes

Hi @codex , your suggestion is probably interesting, but given the lack of replies, few may have understood it. Without a usage example and references to jme’s internal code, it might be difficult to understand the changes you want to make. My 2 cents, could you please provide concrete examples? That way the community can give you some suggestions. :wink:

Yeah, to me it sounds like a good idea but I’m not experienced enough with forced techniques to say for sure.

The post was well written, though… because it convinced me with my limited knowledge. :slight_smile:

1 Like

I have certainly noticed this problem. Glow shows through lemur UI elements and I had never known why until this point.

3 Likes

Another solution would be to use a supplied material if the technique is not present.
Like:

setForcedTechnique(“Glow”,new Material(“MyFallBackMaterial”))

It might turn out to be more flexible, if you need something other then black

That sounds like the glow pass does not use depth testing? Or is it only the case with elements in a different bucket?