Custom Blend Mode

BlitzMax Forums/BlitzMax Programming/Custom Blend Mode

The thing you're trying to do reminds me of the old demo effect `shadebobs` whereby objects are basically `added` to the existing background and when the value gets to the maximum it wraps around at 0 again. That's basically because it was using unsigned bytes which overflow by themselves.

In OpenGL at least, the values are clamped at white 255,255,255 because that is standard OpenGL behavior - there is no overflow, it is discarded. It takes values from the source pixel and adds them to values in the destination pixel and clamps it at 1.0, which is white in floating point. The remainer is lost and I don't think there's anything you can do about it.

To implement any kind of overflow you have to basically have a subtract operation which is not present in standard GL but I think there is an extension that adds a subtract blend mode.

I presume the accumulation buffer could be used whereby you accumulate the backbuffer as 1/2 value, then draw all the lights, then accumulate that, then do some kind of wrap thing.