Want to render with limited colors

So I’ve been making some simulated explosions for a game I’m making, however the main problem is that i want to render the image in the NES color pallet. Is there a way to do this?

?NES. How about post processing in the compositor where you can reduce the color range. It will still save out at 24bit however.

Import color palette to gfx software and do your things there.

How do i reduce the color range in the node editor? I figured i can use nodes for the render layer.

It’s more of a case where i want it to render only 4 colors that i choose, just like how the NES rendered sprites.

Something like this?


How did you pull off the four color node? i cant seem to find that…

I’m amazed blender hasn’t made an official node like this, It’s something some artists need if they want to render only certain colors. BTW thank you for this. I recommend furthering on this project, this has lots of potential.

Whoa, Photox that is a worthy contribution indeed! Deserves a bit of love, I think that you should write up a thread just for the node group, break down the function a bit.

Second 3pointEdit’s comment, this needs a thread of its own :smiley: and thank you very much for this!

Thanks guys, I may go through it and clean it up. There are 4 sets of nodes internally that determine the distance which should be refactored into a secondary node group and reused. I was just too lazy to do it. I’d like to rethink the whole thing and make it more flexible and modular, as it is now it’s just sort of wired together with duct tape. You know it’s bad when you are dealing with boolean logic and you have a greater than node with a value of 2.9 buried inside :no:

I would also add that the first 3 colors I chose were red,green, and blue, but they have no relation to the rgb color space. In other words, you can pick whatever colors you want:


Ah, I get it - the color picked is the output colors, not the input, good to know. Makes sense. Maybe rename it “FourColor Output” so they get the relation, but this is really cool right now.

Yes, they are output colors, the first example might have led you to believe otherwise. The nodes look for whichever of the 4 colors you choose that is closest in rgb space to the input pixel color, and outputs that color. If I rewire it I’ll rename the group.

And as you can see there is no aliasing, it’s a 4 color palette.

I’m going to say this is a great start. I was able to use 2 4-color nodes at the same time and it worked great to an extent, but there will need to be another node that combines them properly. I was using the add math function to pull of the right image.

As it is now, you cannot use 2 of the fourcolor nodes together and add them (or anything) Currently it is 4 (or less) or nothing. How many colors do you ultimately need?

I wondered too if your nide group could be iterative as bit depth tends to be squared.

I only needed four. But the node setup is so clever that it could be enhanced upon. The end result could be exactly like how Donkey Kong Country was made. (3d models converted into 16 bit sprites)

Ok, I’ve noodled with it and found a much more modular solution that could be used for any number of colors. I’m going to take a quick look at the YUVA color space, as I am using a naive euclidiean rgb distance, if my head starts to hurt I’ll just keep the rbg method. I’ll post some updated nodes and an explanation/screenshots a bit later.

Hello! I’ve been searching desperately all over the internet for a nodegroup to do exactly what you seem to have done, but I’m unable to find if you’ve posted it anywhere. If you have, I’d be incredibly grateful to see it. My own projects also need an arbitrary finite-palette, just like the one you’ve shown, but my own attempts to make a node setup to do this have proven to be… Unusable.

My current attempt involved using vector math to map every color in a render to a specific set of arbitrary colors, but if I attempt to use more than a very small amount of colors, blender entirely freezes, due to the inefficiency of my methods. Any help you could offer would be greatly appreciated.

This is a chainable version. You need a minimum of 1 (and one only) ‘retro_primary’ node group, with two retro colors. And then you can chain as many ‘retro_chain’ groups behind it, adding one color each time. This screenshot shows 2 addition colors added to the chain. CC0.

retro_composite_rgb.blend (1.2 MB)

3 Likes