Anyone have any good ideas/algorithms/papers/etc on how to implement an interactive (maybe multi pass) per-object glow while working with the following restrictions…
- My main pass already uses all my texture units. So it either needs to use no texture units or be a multi-pass approach.
- It must be a per-object glow (ie, objects may or may not have glow and each glow may or may not be a different color).
- The glow needs to approximate the glows you see in standard ray tracers (ie a 3x3 blur is not going to cut it on a 1600x1200 display, it needs to be much wider).
- It is a 3D app, so depth is important. Object glows should appear in front and/or behind other objects as would be expected by the viewer. This is the least important restriction. (I might be able to do without this one)
I am not sure there is a good solution out there, but I know I have not seen it all so I thought I would ask. Vertex programs, Fragment programs, extensions, etc are all not a problem as I have used them all before.
So far I have tried…
Rendering the glowing objects first and then ripping the image to texture with a glConvolutionFilter2D set up (tried 5x5). Then returning the texture (screen aligned quad) to the screen and re-rendering the scene over top of it. This was WAY to slow (ripping the texture with the filter is a time killer) and it did not produce a noticeable glow anyway.
Next I tried ripping the image to main memory… let me stop there, I will say no more on that.
Next I tried using automated mipmap generation (GL_GENERATE_MIPMAP) and while this is actually pretty fast, the repeated box filter at each mip map level produces some ugly artifacting at interactive speeds.
So… who has some ideas?