Download Graphicsgale Palette3/10/2024 If(color = colorTable1(0)) <- Compare current texel color to the "Base" Color Table's index 0Ĭolor = colorTable2(0) <- Swap the current texel color to the new Color Table's index 0 You can compare them and make the color swaps inside the shader.įloat4 ColorSwap(InStruct data) : COLOR <- Pixel Shader function signatureįloat4 color = tex2D(image, data.texel) <- Get the image data of the current texel So now that you have a base table if you pass in another palette as a texture: Then using some simple index math you can access each of the colors as if it were an array.Ĭonceptually it would be something like this:īut really you could pass in a texture with a single pixel of each color (I've made a 2x2 just for a bit more clarity): The data can be passed in as RGBA values or you could pass in a tiny texture that has your palette of choice lined up. How you write the Shader to handle the color swap is very flexible. Many different effects can be achieved including palette swaps. You can totally alter image data using Pixel Shaders: Depending on the hardware some games do actually run on an Color Table or Index based graphics engine.īut it is not necessary to run in an indexed color mode (some graphics APIs such as OpenGL give you the option) as you can write your own code to handle color palettes.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |