gdquest-demos / godot-shaders

A large library of free and open-source shaders for the Godot game engine. Here, you'll get 2D and 3D shaders with playable demos.
Other
3.06k stars 182 forks source link

indexing color, palette swap, indexed palette swapping #13

Closed Shadowblitz16 closed 4 years ago

Shadowblitz16 commented 4 years ago

I'm submitting a...

Feature request

Describe the problem you're trying to solve. it would be nice to have the following shaders..

I would just suggest that it be made a shader

Tell us which solutions you've explored, the solution you would pick, and why you think it would be the best for everyone. I am currently trying to get help on the discord to implement a Indexed Color shader but it might be nice to beable to swap colors later

I think it would be good for retro games regardless if they are 2d or 3d

nezvers commented 4 years ago

The best approach I've found is to convert sprite colors into evenly distributed grayscale values and use single-channel value as an index. Because color values go from 0.0 to 1.0 and same is with texture position from one edge to the other. I created free html5 tool SpritePalettizer that converts sprite to grayscale and allows to create color palettes. In the help section, it has an example shader code and links to the GitHub repository of the example projects. Maybe GDQuest wants to include that project?

NathanLovato commented 4 years ago

If you have a palette swap shader that's MIT-licensed you want to share, sure, feel free to open a PR. Note we're specifically looking for shaders and not tools for this repo. Also, each new shader should have at least a minimal demo showing it in action.

Let me know if you need a hand with anything.

nezvers commented 4 years ago

@NathanLovato That is an accompanying example project to show an implementation of assets created with the tool. I'll create a PR soon.