Hi guys,
My question is quite simple. I want to create a small blur fragment program.
To get the current fragment, I do:
TEMP texfrag;
TEX texfrag, fragment.texcoord[0], texture[0], 2D;
My question is, how do i get the neighbouring fragments?
If I do:
TEX texfrag, fragment.texcoord[1], texture[0], 2D;
My image gets darker, indicating that the fragment is black.
If I do:
TEX texfrag, fragment.texcoord[0] + 1, texture[0], 2D;
The program refuses to compile.
If anyone can help, thatโd be nice.
tnx guys.
mfort
2
compute coordinate of next texture sample
ADD texfrag, fragment.texcoord[0], {XOFFSET,0,0,0};
sample texture at next position
TEX texfrag, texfrag, texture[0], 2D;
XOFFSET is not 1 ! it is 1 / texture width
or compute the next sample position in vertex shader and pass it in another texture coordinate, for example fragment.texcoord[1]
Hi mfort,
Sorry for the late reply. I was attending SIGGRAPH Asia.
Your code works wonderfully! Thank-you very much.
Hi again guys,
I have coded a few fragment programs but I have never coded a vertex program before.
Iโm have some problems calculating the offset.
In other words, how do i find out where the neighboring fragment will be?
I should find the texture width and perform an RCP with it. But which vertex variable gives me that value.
Please help.