Free Pixel Art compositor node inside

Hey folks.

So here’s the story. I am a member here for ages, but as life happens I was inactive in the community. During the current social distancing, I watched Netflix’s “Hi Score Girl”. That lead to me looking at MAME again, playing some retro games, and thinking about creating a pixel art game in the upcoming future. :wink:

So I ventured off to check out if there’s any decent Pixel Art Shader in the latest and greatest iteration of Blender and besides some abandoned projects and the age-old shader from Toshihiro Kushizaki I could not find anything. So I decided to do a quick compositor node group for exactly that task.

How to use it to render "sprites"

Render Properties > Shadows > Disable Soft Shadows
Render Properties > Film > Filter Size 0px
Render Properties > Film > Enable Transparent

Import the composite node group via:

Compositor > Enable nodes
Add in compositor: (SHIFT+A)>Group>PixelArt
Connect Image/Alpha

If you want outlines, add a dilate node with step and a factor matching the pixel factor to the Alpha channel.

You can set the pixel factor which defaults to “2” as well as the image color depth.
The default here is 16bit, so 256 colors max. whereas RGB is properly mapped to 3b,3b,2b
It is a faux color depth though because here I am only mapping to the nearest step within the 8bit per channel instead of using palettes which basically everything below 8bit per channel does.
It’s on my todo list, but not feasible the way nodes currently work. I would need a node of the type “python” or write my own node, or hack around with python in a viewer node.
I know builds exist with GLSL and Python nodes and I could write my own node but I rather have something that works with vanilla Blender 2.8+.
I also would have loved to include outlines in the node, not feasible as you can’t control the dilate nodes variable with a connected value. As to why that is I have no idea. Weird decision IMO.

So far I am somewhat happy with the results and if there’s a “need” for a node like that I might look into writing a dedicated palette based compositor node.

Otherwise, CC-0. Have fun:
Pixel Art Compositor Node

1 Like