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.