floating point blending woes

Hi,

much like the poster in the thread:

http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=3;t=012860

I want to render a particle cloud to a fp texture. I want to use multiplicative blending and the only way to make this work that I can see is:

  • Create two floating point buffers
  • Set one as render target and use the other one as a texture
  • Render the particles one at a time as a fullscreen quad with clamped texture coordinates and multiply with the fp texture in a fragment program
  • Flip the fp buffers and render the next particle

This will of course be horribly slow, is there another way?

/A.B.

Ok, answering my own post. It just hit me that since the blending is order independent one doesn’t have to do a fullscreen pass for each particle, the following should work just as well:

  • Create two floating point buffers
  • Set one as render target and use the other one as a texture
  • Render the particles one at a time while multiplying with the fp buffer that is bound as a texture.
  • Flip the fp buffers and render the next particle
  • Bind both of the fp buffers as textures and multiply them together into a third buffer.

This will of course also be very slow since we’re rendering the particles on at a time and changing render target in between.

/A.B.

Hehe, even more comments on my own post. This won’t work, I was writing my post before I hade finished thinking about it.

/A.B.

If fp16 blending is insufficient, then I would suggest splitting the scene up into slabs.

Each slab would become an fp16 texture with few enough blended elements for fp16 to be satisfactory.
You could accumulate the fp16 textures into an fp32 final at the end.

If fp16 is fundamentally unacceptable, then there’s probably not a great gpu-based solution today.

Of course, one can as the original poster suggested blit the result back to the main buffer after each render call, at the cost of twice the number of render target changes.

/A.B.

Cass, is blending supported for 16-bit floating point textures? I didn’t find anything in:

http://oss.sgi.com/projects/ogl-sample/registry/NV/float_buffer.txt

that suggested that it is.

/A.B.

I think this is what you’re looking for:
“16-bit Floating Point Blending and Filtering” on
http://download.developer.nvidia.com/developer/SDK/Individual_Samples/samples.html

Hi Andreas,

As Relic also pointed out, fp16 framebuffers support blending and fp16 texture support filtering.

I would definitely encourage trying that over doing a bunch of buffer changes and blits.

Thanks -
Cass