Author Topic: Using Pixel Processor To Sample Random Pixels  (Read 947 times)

Hi All,

I've been following this https://forum.substance3d.com/index.php/topic,16594.0.html to try to create a pixel processor that will randomly sample a color value from an 8x8 pixel grid and fill that sampled color in 0-1 space.

I keep thinking this should be relatively simple, but I am struggling to get exactly what I want.

When finished, I hope to have a single "randSeed" parameter in my graph that will allow me to randomly select 1 of my 64 possible colors in painter.



I really don't understand why this doesn't work (I have tried many, many, configurations but this seems simplest):


This pixel processor setup works, but it is very awkward to use (you've got to pick both x and y coordinates... etc...)


I've tried everything I can think of and I am totally stumped.  Hoping someone can show me how its done!

Hi,

In order to generate a random value for all pixels in the pixel processor, you have to do it outside of the node: any random function inside the pixel processor will generate a different random value per pixel.

There are multiple ways of doing it, in my case I used a value processor to generate this random value and get this value in the pixel processor.

Also you don't need to generate an integer value, since we sample with "nearest" filtering we'll get the exact pixel color.

sbs is attached

Product Manager - Allegorithmic

This is exactly what I needed.  Thank you!!!