Forum

On pixelsize, pixelwidth and pixelheight -for a better understanding

Hi all,
I got someway stuck translating tutorial-effects-neighbouring-pixels at the end of the first paragraph:

But given a textures original size (WIDTH/HEIGHT) you can compute the distance between two pixels in texture coordinate units. The math is simple: If texture coordinate 0 specifies pixel 0 and texture coordinate 1 specifies pixel WIDTH one pixel has a dimension of 1 / WIDTH. So you can specify the size of a pixel as being:

pixelWidth = 1 / WIDTH
pixelHeight = 1 / HEIGHT

because I can’t get the step from coords to size.
Let’s say we have a texture 400*300.
Talking 'bout WIDTH, we have texcoord 0 pointing to pixel 0 (leftmost) and texcoord 1 indirectly specifying WIDTH (texcoord 1 = pixel number 400, rightmost = WIDTH).

Now, how it happens that a pixel has a dimension? Further, why compute the dimension, the size of a pixel? It’s why it will be rendered in screespace on the mesh? But this has nothing to do with the computation of blur effect itself (I mean: original texture -> blurring texture -> blurred texture on mesh), no?

So, which is the link between “compute distance between two pixels” and “specify the size of a pixel”?

I’ve searched, outside vvvv too, for some hints, didn’t find anything, and still missing logic behind it.

I found the remaining text clear e relatively simple through single steps, but overall is quite vague to me, till I clear out this point.

Thank you very much.

hei h99,

i think your confusion probably only comes from bad wording i chose here. now that i read it again the description “one pixel has a dimension of 1 / WIDTH” really sounds a bit strange.

let me try again:

Given a textures original size (WIDTH/HEIGHT) you can compute the distance between two pixels in texture space units. The math is simple: If texture coordinate 0 specifies pixel 0 and texture coordinate 1 specifies pixel WIDTH the distance from one pixels coordinate to its horizontal neighbours can be expressed as 1 / WIDTH. So while in pixel units a pixels size is of course 1x1 in texture space units a pixels size can be thought of as:

float2 pixelSize = 1 / float2(WIDTH/HEIGHT)

Using pixelSize.xy you can then access neighbouring pixels by adding/substracting that value to/from a pixels coordinate.

does that clarify anything?

Yes, thank you for taking time to answer!

AH!! I should have guessed it was in texture space scale and not in “common pixel space”. Here the system is the texture, and not pixel. Changing system, changed everything.

Sorry, I could figure it out on my own.

Thanks again

great, i updated the info on the wikipage. thanks again for your effort of translating all the stuff. very much appreciated!

It updated, too.
You know, don’t take offense, please, but the learning curve of vvvv is not exactly geodesic ;), from a certain point on.
Translating, for me, is the only way to go deep in vvvv.
And since I’m the farthest thing from a programmer, though my huge efforts to understand, it’s my way to give something back to vvvvolks.

Have a good day, you all out there!