91

GIF drawbacks: very limited color palette, typically 256 colors with ugly dithering (yes, you can have more than 256 colors in animated GIF, but this is uncommon) GPUs don't support GIF compression in hardware (means you will have to unpack them on CPU anyway) you only get to pick ONE color for transparency (unless implementing custom processing) no random ...


32

In order to use any image file as a texture in a game, there must be a texture created on the GPU and the pixel data in the image file must be loaded to that texture. GPUs do not support many of the features that image files on CPUs support. They don't support JPG compression, they don't support PNG compression, and with particular reference to GIFs, they ...


24

A sprites-sheet (often refers to a large image that) is supposed to contain the animation frames of a specific 2d character or projectile in a game. You can almost think of it as the model of a 2d-character. It stores all the various animations created for a specific character. A texture-atlas (is often taken to mean a large 2d image that) contains many ...


16

The problem with using texture atlases and adjacent texels leaking has to do with the way linear texture filtering works. For any point in the texture that is not sampled exactly at the center of a texel, linear sampling will sample 4 adjacent texels and compute the value at the location you asked as the weighted (based on distance from the sample point) ...


13

GIF has a limited color palette. (255) You have to implement parsing and animating the GIF too. So there is not a advancement in time nor in format's technical aspects.


9

Regardless of the level of details and the number of pixels you have, you must start with a thorough understanding on how walking works. If your character looks like shaking its legs, it probably because, that's all you drew : shaking its legs. Just search "Walk cycle" with google image and you'll find plenty of examples. Here is a little example of what ...


9

Pixel art generally responds extremely bad to any scaling. Just a small size adjustment will make pixel art appear either blurry or distorted, depending on what scaling algorithm your engine uses. For that reason it is important to make sure that the graphics are designed in exactly the resolution in which they appear in the finished game. Here is a pixel-...


7

Technically seen it's the same: It's a big image that contains smaller images (sprites). The 3d vs 2d does not make a difference here since almost all 2d game engines use 3d hardware for rendering....


6

You need to create a sprite array Sprite[] sprites and fill it using sprites = Resources.LoadAll<Sprite>("Location"); inside Awake().


5

After spending a week searching the web and checking every related blog post, i found the solution. http://www.denysalmaral.com/2012/04/px-spritesrender-3ds-max-scripted.html This script renders and names the images perfectly, after it i combine them using "GlueIT" Works like a charm, Hope it will help others.


4

You just swap your rows/columns ordering. Iterating from 0 to Frames-1, you first increase X and every time you hit the spritesheets width - increase Y and reset X. The code should be looking like so: for (i = 0; i < Frames; i++) { // Increase the row once every time horizontal range is done if (i != 0 && i % (TempSurface->w / ...


4

I assume you will be using some modern rendering API to draw to the screen, such as OpenGL or D3D. You will certainly want to batch sprites as much as possible and use sprite sheets to reduce the number of textures. A sprite sheet is nothing more than a Texture Atlas (also read this). Once you have a Texture Atlas up and running, it will be up to you how you ...


4

Sort the rendering order by the used sprite sheet and not by distance from camera. This works fine if you use z-buffer and don't render transparent objects. I.e. first draw all the trees (and other objects in the same sprite sheet) into the scene and test and write the depth in z-buffer. Then render all units and do the same. This will result in 2 draw calls ...


4

Ok so based on @Rouze comment regarding the sprite slice renamer, I've managed to mock something up quickly that does the job. Here is the quick mockup I did if anyone else is looking for a quick and dirty way to change the subsprite names. In my research for this subject, it appears I was referring to them as Sub-Sprites when the more known name is Sprite ...


4

The way a computer draws to the screen is very different to say... how we draw on a piece of paper. The computer actually is flipping bits on a memory array, called the video memory. This memory array happens to be represented on the screen as an image a human can understand. With this in mind, let's start: When you draw a sprite—several times, on different ...


4

Holding ctrl in the Sprite Editor allows you to manually move the pivot point with snapping. With ctrl pressed (orcmd on a Mac), you can snap the pivot to one of the pre-defined locations, as defined under Pivot on the control panel: Center, Top Left, Top, Top Right, Left, Right, Bottom Left, Bottom and Bottom Right. The Unity manual does not mention this ...


4

There is no "best" way. There is the way that is most appropriate for your program, in terms of code complexity, managing your data sets, performance, etc, and many of these are questions that only you can answer. If what you're currently doing runs well enough on your target platform(s), it'll do. Having said that, you should consider the reason why sprite ...


4

First of all, there are already image formats with compression. In particular the PNG format supports lossless compression. Furthermore, while it is true that taking a bunch of PNGs and zipping them might be a gain in size, making a texture atlas (spritesheet or similar) will also reduce the size in similar fashion, in particular if you rank up the PNG ...


3

A sprite sheet and texture atlas are nearly the same. They are both bitmap image files (jpg, png, etc.) that contain multiple smaller images, usually in a grid, that are indexed and displayed using software / game engine that locates the individual images by their coordinates. They also both serve to simplify resource management and lower draw calls by only ...


3

One way to do sprite animation with OpenGL ES shaders is achieved by using uniforms and changing texture coordinates in the vertex shader. To elaborate, suppose you have a 1024x128 sprite sheet with 8 frames. Set up a quad whose vertices (clockwise) are (-1, -1), (-1, 1), (1, 1), (1, -1). Assign texture coordinates to the vertices with (0, 0), (0, 1), (1, 1)...


3

Setting a uniform per sprite is probably not a good idea, as Sean Middleditch already pointed out. Tinting a sprite in OpenGL can easily be done by defining the vertex colors. Since the vertices in this case are defined by SpriteBatch.draw(), you should set the tint with SpriteBatch.setColor(). From the SpriteBatch source code: 200 public void setColor (...


3

Sure, this is quite simple really. I'll guide you through Paint.net. Open the application and go to New. In the dimensions, put 8 for width and 8 for height. A new 8x8 canvas will open, typically I zoom in all the way to 3200%. I'll also get rid of the white background layer, by making a new layer, then deleting the background one. Now you have the canvas ...


3

it's trivial, you can do it yourself. Assuming your sprites have alpha value 0 in unused areas, you can do the following (in pseudocode): pixels_out = pixels for y in pixels.height() for x in pixels.width() if pixels(x,y).alpha == 0, neighbour_in_sprite = false for y2 in [-1,0,1] for x2 in [-1,0,1] ...


3

You need a Source Rectangle and Destination Rectangle. The Source Rectangle will pull a rectangle defined by you out of the sprite sheet, then draw it at the specified position. PsuedoCode int width = txtHero.Width / Columns; int height = txtHero.Height / Rows; int row = (int)((float)currentFrame / (float)Columns); int ...


3

The sourceRect is much better for this. Watch this if like a funny video explaining why: https://www.codeandweb.com/what-is-a-sprite-sheet-performance The more technical explanation: I am using pseudo code - the exact number of commands required might vary - but you should see what I am talking about. If you use isolated sprites the game engine has to ...


3

We don't answer questions about which technology to use here, since it comes down largely to personal preference, compatibility with your studio's workflows, and the needs of an individual project. There is an on-topic question here though about the differences between animating individual body part sprites versus pre-rendering your frames to a spritesheet ...


3

If you are seeing trembling in your sprite animations the problem is the pivot point on the sprite sheet. In Unity, the pivot point looks like a blue circle on each sliced sprite in the editor (see screenshot). The pivot point acts as the point of rotation and also the starting point for where the sprite will be rendered in the scene. To fix the problem ...


Only top voted, non community-wiki answers of a minimum length are eligible