Showing posts with label pixel art. Show all posts
Showing posts with label pixel art. Show all posts

18 August 2020

8bit And 16bit Color Palettes

It took me quite a while to understand how 8bit and 16bit palettes work.

To spare you the search, I've decided to write this guide.


Motivation

Creating authentic 8bit and 16bit graphics requires understanding palettes. There are programs and algorithms, which transform your images into 8- or 16bit. Since algorithms cannot guess the intention behind the color choice and miss the context, creating them yourself is more flexible and results in higher quality. It also prevents the loss of details due to quantization. Additionally, to some, pixel-art is about control, and creating the palette gives such.


8Bit Graphics

During the era of the Nintendo Entertainment System, the technology worked with 8bit. Therefore the color of a pixel is represented by eight ones or zeroes. Today a pixel carries up to 32. You might be familiar with the red, green, and blue or RGB, where we split a color into three components. However, dividing 8bits into three colors is ambiguous. That's why there are formats for palettes. RGB332 is the most common for 8bit. It means we assign 3 bits to each red and green, and two bits to blue. A lighter orange would be 111 100 01, which would be 7 for red, 4 for green, and 1 for blue. That's nearly 0, so almost black.

comparisonBlackAndOrange
Comparing the colors.
Left: Black; Right: Our Orange


What Is A Palette

Better idea: We map each RGB value onto a level. 

For example, let's map the following blue levels:

00 -> 0

01 -> 79

10 -> 155

11 -> 255

The color levels (right-hand side) the bits map to is our palette. Back then, hardware limited us to use one palette for all drawn on the screen at the same time. Years later, the Super Nintendo Entertainment System was released. Powered by 16bit, our capabilities increased immensely! A typical format for 16bit is RGB565. Today we use 24bit ("true-color") and the RGB888 format. Some formats use RGBA, followed by four numbers, where A (="alpha") stands for the transparency.

Side note: The sum of the numbers does not need to add up to the number of available bits. Ergo RGB333 is a valid format for 16bits.


Creating A Palette From Colors

Using preexisting colors to create a palette takes three steps. First, choose a format. Then add them to your palette.

Let's use the following colors for an 8bit palette of the format RGB332:


Red
Green
Blue
Black   
000
Color 2
212211198
White  
255255255
Color 4
248216198
Color 5
248197198
Color 6
232173159
Color 7
979943
Color 8
11723473

The format gives us 3 bits for red and green and 2 bits for blue. The formula for the number of representable levels is 2bits. That is enough for 23 = 8 levels of red and green each and 22 = 4 levels of blue. However, our colors have six unique levels of blue (0, 43, 73, 159, 198, 255). Therefore we can't represent all eight colors.


Quantization

Quantization, the third step, will help us here. For this one, we'll merge close color levels.

Our two colors:

248 red, 216 green, 198 blue            232 red, 173 green, 159 blue

will then (for example) become:

248 red, 216 green, 198 blue            232 red, 173 green, 198 blue

By choosing a good looking and distinguishable color level, we can optimize this better than an algorithm. Then we continue adding all needed colors and quantify them to our palette. Now with our palette created, we can color the pixel art.


Tips And Tricks

Reminder: In 8bit and 16bit video games, everything on-screen at the same time uses one palette. Therefore use the same palette for all associated sprites.

The difference between darker colors is harder to notice. Thus use less dark color levels.


Examples


senkoPixelArt16Bit
Senko Pixel Art, 16Bit Palette (RGB565)
 drawn by GreenyNeko

This pixel art of Senko uses an RGB565 palette with the following color levels:

Color1234567891011121314151617...32
Red097126155174197205212222227232248----

Green04654608399106163173188197207211216224234255...-
Blue0434860738893101118159175198236255--



Notice that there's still space in the palette marked by the "-"s.

Senko Pixel Art, 8Bit Palette (RGB332)
drawn by GreenyNeko


This one uses an RGB332 palette with the following color levels:

Color12345678
Red097126155174197212248
Green4683106156173197216234
Blue43106175198


12 December 2018

The Split Between Traditional and Modern Pixel Art

This is a post I wanted to write back when I made my first post about pixel art, sharing what I thought was a good post on making pixel art bigger without it looking too "blocky". Anyways after that post, I had a discussion with some people and it's really interesting.

Where Did Pixel Art Come From?

Back in the old days, when games for consoles like the Nintendo Entertainment System were available. Hardware and software were limited. Due to only saving 8-bit per each pixel of an image only a limited amount of colors could be displayed.[1] Combining this with the limited resolution Pixel Art was the best option back in the old days.[2] Thankfully the detail in each sprite or Pixel Art, as well as the number of colors kept increasing. Continuing through to 16-bit per pixel with the Super Nintendo Entertainment System up to our 24-bit true color system that is widely spread.

Then Why Is There Still Pixel Art?

Even though we don't have the restrictions we had back in the old days, it has evolved into a style for multiple purposes. It may remind us of the old days, it's much simpler to create than drawing a full detailed picture, you have more power over each and every pixel and all the details of the picture since every pixel matters and you can decide over every of their positions, and many more I haven't captured here.

The Split Between Traditional and Modern

Now, with our much better hard- and software we are no longer restricted to the limits we had back in the old days. This resulted in a split between traditional and modern Pixel Art. So what's the difference? What makes Pixel Art traditional and what makes it modern? Where are the bounds of each?

Traditional Pixel Art

Traditional Pixel Art is very strict about its rules. Thus you are not allowed to use more than 16-bit per pixel, which can be enforced by color palettes. Additionally, you are limited in the amount of detail you can add. Plus each pixel needs to be clearly visible so that the control over each pixel is not lost. Though the exact rules may vary from person to person and additional may be added or ones may be removed. Which cuts the bounds of modern Pixel Art.

Modern Pixel Art

Breaking the limits of traditional Pixel Art, this may not be considered to be much anymore. It can be argued whether there are any rules to this but some things can be said at least. First of all, there is no limitation in colors anymore. All the colors of true color can be used for these, which means no palettes or limited color choice per pixel. Pixel Art is all about the pixels. Without any rules, isn't any computer-created art Pixel Art? This is where we can take one of the rules of traditional Pixel Art to help us. Each pixel needs to matter and a change in pixels should be visible. I think this is probably the best way to draw a line. The more detail you add the more blurry each pixel becomes and the more blurry the line between what can be considered Pixel Art and what cannot becomes as well.

Conclusion

Now, this is just my thought on this topic so I don't know how far I'm off or if I hit the bulls-eye. However, even if I'm off I consider this to be a good way to differentiate between Traditional, Modern Pixel Art and the other types of computer-aided graphics that have been made and I don't think you can do any wrong by holding onto these guidelines or rules mentioned here.

[1] https://en.wikipedia.org/wiki/8-bit_color
[2] https://www.theseus.fi/bitstream/handle/10024/133067/Keo_Mary.pdf

14 July 2018

(HD) Pixel Art: Zoom & Fidelity Way

I'm fascinated with pixel art. I'm not good at drawing because I'm unhappy if the drawing isn't perfect. This is what pixel art allows me to do. Unfortunately, pixel art takes a lot of time and can be quite complicated, especially if you start off on zero. Luckily there are some ways on how to start off.

What Is Pixel Art?

In case, someone doesn't know pixel art, this is basically a different technique on doing art, which most often results in the art looking differently. Anyone who has played an SNES, NES or Arcade game you may remember the sweet 8-bit or 16-bit graphics. Maybe you have played Minecraft with standard graphics which is the same thing. Pixel art is usually done by placing pixel after pixel ending up with a full picture at the end. There are multiple techniques included in pixel art to get the results you want and there some more strict or less strict rules on color picking and techniques, but I'm not going into these in this post.   

Starting Off On Something

Now let's see how you can start with pixel art. Of course, it's possible to start off of nothing but it makes things harder, especially for people who are new to pixel art. I've done multiple small pixel arts of sizes up to 64x64. Going higher than that is not as easy anymore, even more, if you haven't gathered any experience. Luckily, I found some ways to get your first bigger art started. Here are some ways to start off I found on the internet:

Using Real-Life Drawing

One strategy I found, starts off on a real drawing that's scanned in or drawn on the computer. Afterward, they use this concept to clean up the lines and thus transform it into the pixel art concept instead. Then all normal techniques can be applied.

Creating Pixel Art Concept

This goes into the direction of starting off without something. Basically what you're doing here is draw a concept pixel for pixel until you get the result you want and then apply all the normal techniques. I can't suggest this to anyone who hasn't gained enough experience. You need to know the techniques and need experience for certain shapes and how to do certain things. Without it you're gonna have a bad time. (Yep, that meme is probably dead... "INVOKE THE DED!")

Zoom & Fidelity Way

Heart using Zoom & Fidelity with
8x8 chunks
By coincidence, I got this weird idea to do it differently. I want to make pixel art and I want it to explode out of proportion. No more 64x64 or smaller. So, what I did was, I created the pixel art using 8x8 chunks of pixels. As you can see, the picture on the right represents a heart drawn out of pixels. However it's not one pixel per black square, it's 64 pixels for each black square. Additionally, this does not look fine or high quality or however you may want to describe it, it looks very very pixelated. It has a low fidelity or amount of detail.



Heart using Zoom & Fidelity with
4x4 chunks
This is the base of the picture representing what I want to make, next up I'm adding more fidelity or detail to it by smoothing the lines with smaller chunks of pixels. This time 4x4. As you can see it looks much smoother but weird. It sometimes happens that it looks weird and that's totally fine. We can still clean up and fix it in the upcoming processes. For now, we just want it to look smoother and have more detail - more fidelity.




Heart using Zoom & Fidelity with
2x2 chunks

Alright, next up we decrease the size of our pixels again. So far I've been using the 8, 4, 2, 1 chain. I expect others to work as well but I'm a fan of binary numbers / the power of 2 chains. Anyways, we're further smoothing out and adding fidelity to our image and you can see the result. We've smoothed out the shape much more it looks much more like a non-pixelated heart now. This is not the end, however.


Heart using Zoom & Fidelity
Last but not least next up we use single pixels to further smooth it out and add fidelity. This is going to be the end result. Now we need to use all the pixel art techniques to make it look the way we want. Obviously, if you see something wrong with the heart that's me showing my inexperience with using the techniques correctly. I just recently started, but you can see how good it looks in comparison to the first one. Additionally, it's now 128x128 and not 15x15 and yet it's still made the same way pixel art is made.

Beautiful.

Conclusion

I've been using these techniques for one of my games and to gain more experience with pixel art as well, whether or not this technique is perfect or can be applied to everything is hard to say. This is something I came up with myself, I don't know if someone else had the same idea. (I'm not claiming anything :P though I could use the money probably haha xD) In the end, this is a technique that did it for me and maybe it helps other people too in either gaining more experience or in making bigger pixel art.

About Me

My photo
I'm a M.Sc. Games Engineer and I created this blog to share my ideas, theorycrafting, thoughts and whatever I'm working on or doing.