So I'm trying to write a tool for my Unity game that will allow me to make a color edit mode. I figured if I went the extra step to make sure my colors were all completed seperated that it would be fairly easy, but I'm still getting far more colors then I actually attempted using when I colored the picture. The picture was done with vector graphics so I know the precise color of each not including the aliased lines which are interpolated with a completely alpha color.
I'm not 100% that aliasing is the problem but otherwise I am completely unsure why there would be in the realm of 4000 different colors showing in my photo. They all seem to be really similar versions of the same color so aliasing is the only thing that makes sense. The idea is have a color mask, a and a pallete to map use selected colors too at run time.
This is just a sample file of peach from paper mario I'm using to test the system
PrincessColor.png 4.25MB
15 downloadsThe goal is to use this color map with the BW and a shade map to construct the final picture. I was separating the BW from the color to try and solve the aliasing issue but that isn't the solution.
Hopefully looking like this in the end.
ColorPrincess.png 297.65K
16 downloadsI got it working in photoshop but need to find out how to export this to my game. I could do it by exporting each clip mask out as a picture then recombining them mathematically to guarantee they are exact, but exporting 6-12 pics per frame then recombining is more work then it should have to be. Any help would be appreciated.
Code:
[source lang="java"]public class ColorEditorWindow : EditorWindow{ static ColorEditorWindow window = null; List<Color> ColorPallette = new List<Color>(); // Use this for initialization [MenuItem("Window/ColorEditor")] static public void Start () { if (window == null) window = EditorWindow.GetWindow<ColorEditorWindow>(); } public void GetPallette() { if (texture != null) { //Reset Pallette if previous one existed if(ColorPallette.Count != 0) ColorPallette.Clear(); Color temp = new Color(); //cache color value to use as temporary for (int i = 0; i < texture.height; i++) { for (int j = 0; j < texture.width; j++) { temp = texture.GetPixel(j, i); //Get pixel to test if (temp.a == 0)//Ignore pure alpha colors continue; //See if color is unique for (int k = 0; k < ColorPallette.Count; k++) //If color exists in pallette skip it -- goto is ugly consider something else { if (ColorPallette[k].r == temp.r && ColorPallette[k].g == temp.g && ColorPallette[k].b == temp.b) goto NEXT; } ColorPallette.Add(temp); //If not in pallette add to pallette NEXT: continue; //If temp exists go here and continue. } } } } public Texture2D texture = null; public void OnGUI() { texture = EditorGUILayout.ObjectField(texture, typeof(Texture2D)) as Texture2D; if (GUILayout.Button("Get Pallette")) { GetPallette(); } /* for (int i = 0; i < ColorPallette.Count; i++) ColorPallette[i] = EditorGUILayout.ColorField(ColorPallette[i]); */ EditorGUILayout.LabelField("Colors: " + ColorPallette.Count); }}[/source]

Find content
Not Telling