PDA

View Full Version : 3x3 convolution using ati fragment shader



default
04-11-2003, 08:27 AM
Hi,

i'm just been thinking about trying to do realtime convolution using ati's fragment shader and passing the kernal and the normalizing cooef as parameters, simple ones that don't require too many neighboring pixels are ok, (such as humums demo (where he does Laplace or the delphi3d demo using 4 pixels and combiners), but i've been thinking about trying to do one using a 3x3 kernel. I dont know if it is at all possible if NumberOfTextureUnits < sizeofkernel. I thought doing mulitple passes and accumulating the points and in the final pass do the division, but as far as i know it wont work because there is not enough precision in the texture buffer. Is there anysort of workaround or possible trick that may work... Would it work with better graphics (9700?, though it only has 8 texture units ) using arb_FP?

vincoof
04-11-2003, 09:06 AM
With ATI_fragment_shader extension, you can look up up to two texels per texture unit. In other words, with 6 textufre units (6 is the minimum available) you can get up to 12 texels par fragment. A 3x3 kernel could be then be performed.

You're right about the precision issues.
ARB_fragment_program does not really help in its own, but floating point framebuffers do, I suppose.

Why don't you look upon the convolution features of the ARB_imaging subset ? It is a ready-to-use solution.

default
04-11-2003, 09:38 AM
yeah i'll take a look at ARB_imaging, i but i just wanted to do something with fragment programing and this was something relativiely simple to get started with. thanks

default
04-11-2003, 10:36 AM
"you can look up up to two texels per texture unit. In other words, with 6 textufre units (6 is the minimum available) you can get up to 12 texels par fragment"

I dont quite under stand what you mean by this: i can bind an interpolator to a register using SampleMapATI (this will give me the texel at the the texture coordinate for the specifed unit, into the register is specifed), but how would i access a second position on the that texture? Thanks

[This message has been edited by default (edited 04-11-2003).]