Copy link to clipboard
Copied
I need to make a following thing in substance designer - let's say I have an image with four areas overlapping each other Red, Purple, Blue and Yellow for example. Is it possible to compare all neighbouring colors in the image and draw a Black border line between Red and Yellow neighbouring colors, and to draw a Green border line between Blue and Purple colors?
Something like this:
1 Correct answer
Copy link to clipboard
Copied
You could use the pixel processor and write a function to compare neighboring pixels and decide what border colour you want at that pixel. I would use that to output just the borders and then use Shape stroke to expand the borderlines to the width you want them, before blending back with the original image.
Dave
Copy link to clipboard
Copied
Oh ok, unfortunately I'm not sure how to do it in pixel processor.. Any guides / hints you could share on the setup please?
Copy link to clipboard
Copied
Hi,
The pixel processor is a bit of an advanced but very useful node. It looks at each pixel individually in the input image and applies a function, which you create, to that pixel. It then outputs that result at the same pixel location in the output. It then moves on to the next pixel and repeats the same function until all pixels have been processed.
In your use case, you would want the function to examine the neighbouring pixels around the one being processed and decide whether the output should contain a border pixel and of what colour or just be transparent i.e. alpha 0.
There is more on the pixel processor here:
https://www.youtube.com/watch?v=5s1p7etqlUw
and here:
Dave
Copy link to clipboard
Copied
Tanks a lot I will check those vids!
Copy link to clipboard
Copied
Hey Nitrolium,
I made something real quick, it's not tested or optimized, but it does what you need and you can easily edit it.
The node takes 2 colors as input parameters, so you can decide which color you want to separate and a border color, so it does it one by one, to keep everything common and editable.
Stay healthy and creative Marco
Copy link to clipboard
Copied
Oh this looks promising thanks! But for some reason I can't download the file you attached - it is stuck on Virus Scan in progress..
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Man this is really cool thank you very much! The only thing - how do I then get some individual control over those border lines? For example let's say I want to distort Green and Black border lines with Warp node using different warp intensity settings for those border lines?
Copy link to clipboard
Copied
And another question if I may - with colors it works perfectly well but when I'm switching to image that is grayscale it gets a bit unpredictable most probably due to tolerance. So let's say I have a grayscale image with lots of values 30, 56. 255, 0 50 etc. and I need to have a border only between areas that have 33 and 34 in their grayscale values - it's not always precise sometimes affecting neighbouring values.
I tried adjusting tolerance but with no much luck, can you please help with that?
Copy link to clipboard
Copied
Can you send me an example image? The Node works for Color images, because that was your initial question and yes it should work for grayscale values as well, since the comparison is basically the same, but for one channel. If your distances between the values are very small, use a 16Bit Texture or even a 32Bit one, to keep precision very high. And use a very low tolerance value.
Send me an example and I see, what I can do.
Copy link to clipboard
Copied
I created this node, so it stores the Lines in the Alpha Channel. So you can use the Alpha Channel as a mask and use it also as an input to drive your warp.
Stay healthy and creative Marco
Copy link to clipboard
Copied
I did a few tests more and it looks like your node works perfectly well! It was actually my texture that had a few off-color areas that was causing issues! I really think you did some amazing work on this node Marco, thank you very much!
Could you recommend some good tuts/course to get the hang of Pixel Processor? Cos majority of those I find on youtube are only touching the base without any advanced stuff which you did here (as far as I understand).
Copy link to clipboard
Copied
Actually what I did is very basic Pixelprocessor stuff, but I know what you mean, tutorials on the Pixelprocessor are very rare. That's why I'm working on a tutorial series at the moment, unfortunately it's a side project, so i work on it during my freetime, so I have no idea when I'll finish it, but when I do I'll let you know.
Stay healthy and creative Marco
Copy link to clipboard
Copied
This sounds great! I subbed to your gumroad and artstation to stay tuned to your updates!

