Basically, I've made the switch to libgdx and I enjoy it quite a bit. I also recently read up on my pixel art theory and the like and have grown fascinated with the idea of using limited color palettes. In particular, this resource has made me realize what I've been looking for for quite some time:

My question is--in addition to the fact that you maintain visual consistency throughout your piece and lend a (perhaps subjectively) nice element of aesthetic pleasure to your pixel art--is there a performance gain to be had with using a limited color palette? The above work shows the use of 16 colors, which is frankly quite amazing and works pretty well, but I'm thinking more along the lines of pursuing 256 colors after doing some posterizing tests and such with GIMP on some game art I've picked off Google. I'm still learning a lot about graphics but want to know if having a limited palette could lend a boost in performance through libgdx, or least OpenGL, more specifically. I apologize for my naivete! Thank you in advance for your help and suggestions.

I see what you mean. I know the Color class in libgdx can set its integer representations to 16, 24, and 32-bit, but I don't see any 8-bit options. I'm just trying to think if it would be worth settings something like that up by hand for any sort of gain. I can't imagine the gain would be extreme, but it would be nice to be able to take advantage of a 256-color palette in that regard. :]

Yeah, except from the memory savings, you won't gain much (if any) performance, as today's cards and architectures are tuned for 32-bit colors.And the memory savings will be negligible if you use pixel art. A 32x32 sprite costs nothing, even at 32-bit color depth:

Appreciate it. Didn't really have what I was looking for, though. I was thinking more along the lines of indexed colors, which I read more about through just the Wikipedia article and was able to learn a bit more about it. I may do some research into it with OpenGL, but arnaud's information suggests it may not be worth the time.

Yeah, except from the memory savings, you won't gain much (if any) performance, as today's cards and architectures are tuned for 32-bit colors.And the memory savings will be negligible if you use pixel art. A 32x32 sprite costs nothing, even at 32-bit color depth:

Indexed colours only reduce file size. Once the file is loaded, every single pixel will have a 32-bit int for it's colour, unless you use a different format. Unfortunately that also decreases your available choices before you even make a palette.

Indexed colours only reduce file size. Once the file is loaded, every single pixel will have a 32-bit int for it's colour, unless you use a different format. Unfortunately that also decreases your available choices before you even make a palette.

But yes, as said, the difference is not worth it.

I was under the impression that was not the case, otherwise it would just make sense to use 32-bit color to begin with. My understanding is the pixels are rendered based on offsets rather than storing their own color data. Here's an excerpt from the Wikipedia article:

HeroesGraveDev is correct, he said "unless you use a different format".You can tell in what format an image will be stored in graphics memory, when you load it with glTexImage2D for example (google it and you'll find all the color formats listed).

OpenGL fixed pipeline does have support for palettes and color indices (never used it though, and I dunno how do it with shaders either), but it's rarely used, because nowadays it's not worth the hassle. I doubt LibGDX uses it, it probably just tells OpenGL to store all pixels in graphics memory as 16, 24 or 32bit, without using color indices, to keep things simple. You'd have to code directly with OpenGL to use its palette capabilities.

Just work in 32bit color depth, that way:- you have all the colors you want- you lose no performance, and almost nothing in terms of memory- you have alpha- you don't have to worry about anything, it'll work (tm)

Limit your palette on the artistic side, when you create your images/sprites, NOT on the technical side, which just brings more troubles than benefits.

HeroesGraveDev is correct, he said "unless you use a different format".You can tell in what format an image will be stored in graphics memory, when you load it with glTexImage2D for example (google it and you'll find all the color formats listed).

OpenGL fixed pipeline does have support for palettes and color indices (never used it though, and I dunno how do it with shaders either), but it's rarely used, because nowadays it's not worth the hassle. I doubt LibGDX uses it, it probably just tells OpenGL to store all pixels in graphics memory as 32bit, to keep things simple. You'd have to code directly with OpenGL to use its palette capabilities.

Just work in 32bit color depth, that way:- you have all the colors you want- you lose no performance, and almost nothing in terms of memory- you have alpha- you don't have to worry about anything, it'll work (tm)

Limit your palette on the artistic side, when you create your images/sprites, NOT on the technical side, which just brings more troubles than benefits.

I see. That makes sense, especially considering the fact that I would like to be able to incorporate colored box2dlights, shaders, Post-Processing, and whatnot, but it was nice to at least think about it and figure out why it wouldn't work. Thanks!

It might be interesting to view the Another World 15th anniversary edition Making of video (which is French, but with subtitles), which talks about the subject of using a limited color palette (16 colors) to still create something that breathes atmosphere. That game in particular was a huge success in that department.

It might be interesting to view the Another World 15th anniversary edition Making of video (which is French, but with subtitles), which talks about the subject of using a limited color palette (16 colors) to still create something that breathes atmosphere. That game in particular was a huge success in that department.

don't waste your time to store images in a different format than rgba 32 bit. It just makes things more complicated. The performance improvement can be done in most games with the correct usage of modern opengl (no glBegin, glMatrixMode, etc). There was something called color index mode, but it is deprecated, if you want it back you need to implement the color lookup in the fragment shader. Texture compression is something you could use.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org