In: Atomic Nodes
The Pixel Processor allows you to execute a custom function for every pixel that is returned as output, on an optional input.
It is by far the most versatile node, as it allows any mathematical operation to be run and return results inside your graph.
Similar to FX-Map, it requires to set up the internal functionality to perform anything. Where the Pixel Processor differs from FX-Map is that it is not focused on placing patterns, with multiple functions controlling pattern shape and placement. Instead, a single function is run in parallel for every pixel, where each pixel is unaware of the calculation results of its neighbors. The Pixel Processor is similar to the Value Processor, which runs on only single values and can provide a nice optimization compared to the Pixel Processor.
For anybody used to creating Shader functions in Node-based editors, the Pixel Processor should be a familiar environment.
- Color Mode: Color/Grayscale
Sets what sort of output value is returned
- Per Pixel Function:
Allows you to access the internal function editor.
This section is not a full usage guide, rather it explains a few specifics for the Pixel Processor node. It's recommended to read about creating functions first, before continuing in this section.
Hit Ctrl+E with the Node selected, or Press the Edit button on the node to access the internal function.
Output type needs to match that set in the Node's Color Mode Parameter:
- Color: output must be a Float4
- Grayscale: output must be a Float(1)
Changing Color Mode while an output is already defined, the node will convert the output to the selected format, but you are losing some performance or calculating too little information.
If the output returns pure black, there is probably an error in the calculations somewhere returning incorrect values.
Using Inputs in a Pixel processor requires some specific setup unique to the Pixel Processor. It is the main area where the Pixel Processor stands apart from the FX-Map It is very similar to setting up a texture sampler in a Shader editor.
Essentially you specify what input to sample, by using a Sample Gray or Sample Color Node, and then connect a "UV"/position coordinate of the Float2 type to that Sample Node's input.
The above setup samples the input0 slot as a color input, and uses the internal $pos value as the coordinates. $pos matches the X and Y index of the current pixel being calculated, essentially serving as UV-coordinates.
The Position used for a Smaple node does not have to be the $pos value, youn can use any function you want as input, even other sampled maps, or complicated transformed coordinates.
Conversely, you can use the $pos value to drive other effects than sampling an input, such as using it to interpolate between different values across the image: creating your own gradients for example.