### Author Topic: Get Neighboring Pixel in Pixel Processor  (Read 5302 times)

#### QuantumTheory

Hello!

I'm quite confused, even after watching the pixel processor youtube videos.

In the pixel processor, I want to be able to sample some neighboring pixels, process them, and output a new pixel. How can I sample neighboring pixels within the pixel processor?

I feel I start with the \$pos, swizzle it, then subtract from the x and y coordinates as needed. The problem is, what is the subtrahend if the float value is resolution dependant?

If the texture is 16x16,  0 is 0 and 1 is 16 with floating point ranges in between. Same with higher resolutions, but those floats in between all change. What is the calculation to get that neighboring pixel float value? Am I thinking about ths this wrong?

Thanks and hope I explained that clear enough,
Pete
Check out my Substance Blog!
http://www.qt-ent.com/Blog

#### justaviking

You were hoping for an INTEGER value, I presume.

Something like this???
- Get pixel (7,9)
- Then find one on each side of it (6,9) and (8,9)
- Average the neighbors, and use the result to update pixel (7,9)

Hopefully I understand the question.  Too bad I don't know the answer (yet).
Hobbyist
----------
Common "Help" suggestions:
- LOG FILE tips - https://forum.allegorithmic.com/index.php/topic,22451.0.html
- LICENSING issues https://www.allegorithmic.com/contact
- ATTACH files and pictures to posts: https://forum.allegorithmic.com/index.php/topic,23670.0.html

#### QuantumTheory

Pixel positions are float2's.
Check out my Substance Blog!
http://www.qt-ent.com/Blog

#### justaviking

Yeah, I guess that was clear in your question.  I let an assumption of your question get in the way.  I should have read your post a second time and posted more slowly.  Sorry about that.
Hobbyist
----------
Common "Help" suggestions:
- LOG FILE tips - https://forum.allegorithmic.com/index.php/topic,22451.0.html
- LICENSING issues https://www.allegorithmic.com/contact
- ATTACH files and pictures to posts: https://forum.allegorithmic.com/index.php/topic,23670.0.html

#### Nicolas Wirrmann

To sample the neighbor pixel you need to compute the pixel size corresponding to the current image size.

To do so: Getfloat2 / \$size
1 / Swizzle x gives you the pixel size
Pos.x + pixel size is the x coordinate for the pixel on the right.
Product Manager - Allegorithmic

#### QuantumTheory

Thanks Nicholas! I found this out on my own just 10 minutes ago and came back to post that.
Check out my Substance Blog!
http://www.qt-ent.com/Blog