Palette System - #37
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an alternative system for coloring material shapes -- palettes. Original idea by @june_username in the GTNH discord.
A palette is a PNG for one or more materials, where each material has an index to some column of that PNG. A material indicates it uses a palette through a builder call, where it specifies the name of the palette and its column. Then, instead of tinting shapes, it will replace the grayscale pixels with colors from the palette (maintaining alpha from the original art). It does the replacement such that the palette column (descending) maps to the art pixels by HSV value (descending). That is, the top pixel in the column will replace the highest-value pixel, and the bottom the lowest. If there are less pixels in the column than differing HSV values, the bottom column pixel is repeatedly used as necessary.
The palette system still respects layers. The layers are flattened onto the base image before the palette is applied, blending (see
PaletteBaker#compositeOver) each layer. The overlay, similar to tint, remains uncolored.Example material added showing using a short palette column, and an animation.