Problem with HDR + bloom

Windows XP / Vista
OpenGL 2.1
Driver 191.07

When HDR and bloom are enabled, black squares appear on some meshes that are within range of a point light. No OpenGL errors occur, and the program works fine when a regular RGBA texture is used for the bloom blur buffer.

I have never seen anything like this.

In my experience, such artifacts happen when you got a NaN in your shader. Most likely cause is a division by zero, or even more often, a pow or a sqrt operation with a negative number. It may be solved by clamping your values before doing such operations.

The reason you get those black squares (that’s my theory) is because of the blur in the bloom. The size of those black squares probably correspond to the size of your blur kernel. If only one of the samples is a NaN, the sum of the samples then the division will all become NaN.

It also explains the difference of behavior between ATI and NVidia cards, as they probably treat the NaNs in different ways…


It actually was fixed by setting the minimum value of the blur samples to (0,0,0,0). I know my mesh shader is writing (0,0,0,0) into the blur buffer, but somehow it seems negative numbers are showing up.

Problem solved, although I’m not entirely satisfied, since there shouldn’t have been an error in the first place.

Another really weird thing is a 4x downsampled image is being drawn with linear filtering for the bloom effect, yet the black squares were perfectly sharp on the edges. Go figure.