Lookup table palettization#1823
Closed
petchema wants to merge 13 commits into
Closed
Conversation
added 8 commits
May 15, 2020 00:59
Remove one bit from all color component in input, to reduce LUT size (128x128x128). That's still a 8MB table. Improvements: - Reuse k-d tree work to accelerate initialization - Only store palette indexes in the table to reduce its size by 4. However, that means palettization will really be limited to 256 colors.
Also, harden against degenerated trees
Collaborator
Author
|
Benefits:
|
Collaborator
Author
|
initialization time down to 850ms using Color32 |
Collaborator
Author
32277bd to
57503b4
Compare
I guess I should have done that before. I hope it doesn't change the result, I wonder if it does any rounding behind the scene...
Collaborator
Author
|
I'm reverting FilterMode.Point, because it's rounding access and I want "rounding down" (floor) instead. |
FilterMode = Point will do rounding in true color space, so remove rounding in lookuo table.
76cc753 to
b897a14
Compare
Collaborator
Author
Owner
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.











Very fast palettization (up to 280~300 fps on my hardware) using a Texture3D as lookup table.
I get results pretty close to my previous shader by dropping 1 bit from each color component (128x128x128 lookup table). Texture takes 8MB and requires
2.4s850ms (on my hardware, again) to initialize.Other tradeoffs can be made by modifying lutShift in RetroRenderer.cs (that I haven't exposed as a setting... yet?)
I could also lower memory requirements to 1/4th by only storing palette indexes in the lookup table, at the price of an additional lookup in color palette...