Pangamma / PixelStacker

A program built to make multi layer pixel art using blocks from Minecraft. It incorporates the use of stained glass stacked on top of other blocks in-game. The result is better blending and more color selections.
Other
67 stars 16 forks source link

[suggestion] pattern export / layers / color matching #24

Closed EvilErwin closed 2 years ago

EvilErwin commented 3 years ago

Hi, first of all: great projekt! This is a very helpfull tool. Thank you for putting your time into it.

I have three suggestions:

1) A pattern export / render-mode that uses symbols for the diffent block types. I try to use your tool in survival without any mods. I find it difficult at times to see the differences between block types. Especially similar colored glass blocks next to each other. Could you implement a "redner-mode" where every block type is representet by a symbol instead of the block texture? See the image for reference. cross stitch pattern mario This is a pattern for cross stitching, but it shows what i have in mind. Its a trivial example with very distinct colors so there is not much advantage in using symbols. But if you have a image with very similar colors next to each other it would help.

2) Layer selection like in image editors. When i render a image in your tool, with the 2. layer activatet, i have the following view options:

With this all three view options are only one click away. And everyone who used a image editor is familiar with the concept.

3) Color matching. I have not looked into your code, so i don't know if you are already using this. I had a project where i had to match colors similar to this tool. In my online research i found different methods to calculate the difference between colors. Those methods simulatet the human color reception with varying success. subpar: Euclidean distance in RGB color space. better: CIEDE2000 in CIELAB color space. See the following link for reference: https://en.wikipedia.org/wiki/Color_difference I don't know which method your tool is using or if you already looked into different methods. I only wanted to mention this in case you didn't know of this. There is a chance to improve the render results by using other ways to calculate the color differnce. Under the assumption that the limitet color palette of minecraft leaves room for improvement.

Pangamma commented 3 years ago

Thank you! I'm glad you enjoy the program and I am happy it is proving useful for you. @EvilErwin

Responding to your suggestions- It'll be easier to track if this is split up into 3 separate issues, but I can use the numbering system below.

  1. I see what you mean. This is a good idea for a way of providing support for people with partial or full color blindness. I want to dive into this idea more. Hopefully you can help me with the finer details.

    • This approach will work for a smaller number of colors. Maybe the top 32 color combinations could be marked in this way, and everything else is left blank.
    • If you right click a block in the viewer, it will show the names of the materials that make up that tile. It's on a block by block basis though.
    • The maximum number of colors (based on the color palette available) is something like 4,300+ different color combinations! We don't have enough symbols for all of those to have unique representations.
    • Would this work in double-layer mode? And if so, how would you represent different symbols for different layers? Would it be a combined symbol?
  2. Fair enough. I'll look into making a better UI for that based on other image editors.

  3. The current formula is below. I did try to use cielab colorspace at one point but it turned out horribly and was extremely slow. The equations were like 1000 lines long or something ridiculous like that so I gave up. If you can come up with the cielab colorspace algorithm and you want to try it here, you can go for it. Make a PR or suggested code fix here and I'll see if it performs better or not. For this one I went with a simple RGB distance algorithm with the addition of hue as one of the things to consider ontop. The hue part makes a big difference in human perception.

        /// <summary>
        /// Custom color matching algorithm
        /// </summary>
        /// <param name="c"></param>
        /// <returns></returns>
        public static int GetColorDistance(this Color c, Color toMatch)
        {
            int dR = (c.R - toMatch.R);
            int dG = (c.G - toMatch.G);
            int dB = (c.B - toMatch.B);
            int dHue = (int) GetDegreeDistance(c.GetHue(), toMatch.GetHue());

            int diff = (
                (dR * dR)
                + (dG * dG)
                + (dB * dB)
                + (int) (Math.Sqrt(dHue * dHue * dHue))
                );

            return diff;
        }
Pangamma commented 2 years ago

Can't add this without more info.