This week I'm in a vacation and I'm working on my game engine for my solo game. At the start of the week I worked on a palette shader that I'm been thinking about for a long time.
Here's the result first, the fighter is a temp sprite from OpenArt to test engine features.
A 🧵
#gamedev #zig #hlsl
Here's the result first, the fighter is a temp sprite from OpenArt to test engine features.
A 🧵
#gamedev #zig #hlsl
Comments
We then sample the texture to get the palette index and read the packed color from the palette. It is then unpacked into a float4.
Before I used R8_UINT texture and Load() but using UNORM permit more filtering options.
* Store the indices as pixel value of a single channel texture
* Store the palette into a buffer instead of a texture for easier reading and less memory usage.
* Sample the indice and fetch the color from the palette in the pixel shader.