The pixel art sprites come out great with Blender, however the in-game engine uses a color Palette (.pal) index for certain effects. Green is transparent and Red is ground shadow. Whitish Blue is for glow but not that important. I am using this sprite as an example. The model is normal. I used the Composting nodes to simply add a green background while rendering. The shadow is a mirror model shrink-wrapped to an invisible plane with an emission material red to mimic a shadow. This was easier than using an actual green background (image as plane) because the render would leave a greenish outline around my sprite when I apply the palette in post. Getting a red shadow using light ray nodes was also difficult so I "made" a model to mimic a shadow but when I render the image the fake "shadow" is no longer just red, it has parts that are lighter and darker which messes up the post application of the .pal palette file.
As you can see, the background is now a dull green with off color green pixels and the red "shadow" has orange and yellow pixels. I would like these to come out the solid green and solid red I set them to originally. Right now, my work around is to render the background and shadow model separately then apply a .pal that ONLY has the green and red I need in the index then save the file. I then go back and render the real model without the background and shadow model on transparent film. I then use GIMP to open as layers and combine then export the single image. Finally, I open this image and apply the .pal file but one with 256 color index and save. Problem is I have to do this hundreds of times since these sprites are stored as single animated frames!
I tried toggling the anti-aliasing, lighting, dithering etc. What looks promising was a post using math nodes and color ramps. However, I still get the same results where the final image has too many different greens and reds. I know Blender is probably overkill to use to produce these sprites but I am very comfortable with it. Another option exporting each frame as an .fbx model and then cramming this into Fragmotion which actually lets me set the background and shadow colors.
I know it's a lot, but I feel like somebody might have a solution that I am overlooking. Ideally I would love to render an image that had the green background stay green and the red shadow stay red and my real model would reduce to whatever works when I create the .pal file. This way I dont have to combine layers in GIMP. When I create or apply an existing .pal file it looks for anything close to red or green, so having all these pixels slightly off color causes them to not be read and stores off-color reds and greens that are not desirable. If I could get the green to only show up as the green I need (RGB: 0,255,0) and the red "shadow" model to only show up as the red I need (RGB 255,0,0) then the other chips can fall where they may. The first two indexes in my palette need to be the green and then the red, or else it crashes the game or worse.
Is there anyway to ensure Blender ONLY renders these two important colors as the RGB values I set without causing slight variations in the color due to light or ditehring???