I have implemented decals in our new game engine, and I am having trouble with some design decisions.
Decals can be large or small. Sometimes they might appear only on a moving object, like a bullet wound in a character's leg, or a blast from a grenade that marks the corner of a room.
In our renderer, decals are drawn using the lighting system, so by default they appear on all surfaces within their volume. I need to pass information to the GPU that will allow the decal to select which objects it should appear on, but I am not sure how this should be decided. Without this, any dynamic object through near a puddle or scratch marks on a wall will have the decal appear on them.
I could specify one specific ID of the only object a decal appears on. I could use a filter system of bitwise flags to control the type of object a decal appears on.
Do you have any better ideas? What would be best for the end user?