Jan

09-10-2003, 08:20 AM

Hi

I want to blur a texture, by putting it in all 4 texture-units, offsetting the texcoords a bit and then averaging the values.

Now, of course i want to blur as efficiently as possible, meaning to reduce the passes needed.

For this i want to use bilinear filtering. However, to be able to really take advantage of bilinear filtering, i have to calculate my texcoords very carefully.

Some ASCII art:

-------

|T|T|T|

--X-X--

|T|T|T|

--X-X--

|T|T|T|

-------

A "T" stands for a texel. An "X" is the intended position of the texture-coordinate.

If my texcoords point to those positions, than every texcoord samples from exactly 4 texels.

Now the question is: What location does a texcoord like (0|0) point to? Is it the center of a texel, or is it a border/corner where 4 texels meet? And does (0|0) point to the same position as (1|1), or is there a difference?

Letīs just take the case of a 3x3 texture. Which coordinates does "X" have in this case:

-------

|T|T|T|

-------

|T|T|T|

--X----

|T|T|T|

-------

Is it (1/3 | 1/3) or is it (1/6 | 1/6) ? Or might this position even be (0 | 0) ?

Thanks in advance,

Jan.

I want to blur a texture, by putting it in all 4 texture-units, offsetting the texcoords a bit and then averaging the values.

Now, of course i want to blur as efficiently as possible, meaning to reduce the passes needed.

For this i want to use bilinear filtering. However, to be able to really take advantage of bilinear filtering, i have to calculate my texcoords very carefully.

Some ASCII art:

-------

|T|T|T|

--X-X--

|T|T|T|

--X-X--

|T|T|T|

-------

A "T" stands for a texel. An "X" is the intended position of the texture-coordinate.

If my texcoords point to those positions, than every texcoord samples from exactly 4 texels.

Now the question is: What location does a texcoord like (0|0) point to? Is it the center of a texel, or is it a border/corner where 4 texels meet? And does (0|0) point to the same position as (1|1), or is there a difference?

Letīs just take the case of a 3x3 texture. Which coordinates does "X" have in this case:

-------

|T|T|T|

-------

|T|T|T|

--X----

|T|T|T|

-------

Is it (1/3 | 1/3) or is it (1/6 | 1/6) ? Or might this position even be (0 | 0) ?

Thanks in advance,

Jan.