linerrecycle.blogg.se

Nes classic pokemon palette swap
Nes classic pokemon palette swap







I wouldn't worry about wasting VRAM for a few character textures. This worked like a charm for achieving Megaman-like palette swapping! I use the source pixel's red channel as an index to the color table. Vec4 indexedColor = texture2D(colorTable, index) īoth textures are 32-bit, one texture is used as lookup table containing several palettes which are all the same size (in my case 6 colors). Vec2 index = vec2(color.r + paletteIndex, 0)

nes classic pokemon palette swap

I worry that duplicating textures just to change a color in them is wasting VRAM - should I not worry about that?Įdit: I ended up using the accepted answer's technique and here is my shader for reference. Ideally I would like to use a shader since it seems straightforward and requires little additional work opposed to the duplicated-texture method. If shaders are not available (say, because the graphics card doesn't support them) then it is possible to clone the "original" textures and generate different versions with the color changes pre-applied.Use a shader and write some GLSL to perform the "palette swapping" behavior.There are two ways I know of to achieve the effect I want, but I'm curious if there are better ways to achieve this effect easily. On modern hardware, though, this is a bit more challenging because the concept of palettes is not the same.Īll of my textures are 32-bit and do not use palettes. This kind of effect was common and quite easy to do on the NES since the programmer had access to the palette and the logical mapping between pixels and palette indices. Not all of the sprite's colors change, only certain ones do. For reference: in Megaman when you change your selected weapon then main character's palette changes to reflect the selected weapon.

nes classic pokemon palette swap

I'm working on a Megaman-like game where I need to change the color of certain pixels at runtime.









Nes classic pokemon palette swap