Animation from spritesheet out of phase in Unity - animation

I'm using the sprite editor from Unity to load spritesheets as animations. I don't know why the sprites end up being out of phase, causing a shake effect during the animation.
Here's one of the spritesheets
Idle animation spritesheet
Here's how it looks loaded in unity
Idle animation in Unity
I have already tried if the spritesheet is correct in this website: http:// is.si/animator/ , and it is (configuration is 432 x 407 per frame, 25 frames and frame time 1).
I give it a try in a blank project, and it has the same problem
Note: the configuration in Unity's sprite editor is 5 columns, 5 rows (by cell count), or 432x407 (by cell size). The pivot doesn't matter, I have the same error using any pivot position.
Thanks for your time

I found what the problem was. The spritesheet were bigger than 2048 (in the width), and by default Unity compress all textures to 2048. So the compressed image wasn't divisible by 5 anymore.
I solve it by setting the compression to 4096 (size don't matter becouse all the blank space gets eliminated when using sprite packer).

Related

Position of player changes when the attack animation starts - unity

So I did an attack animation in the program Aseprite and everything was fine with the animation, but when I put in inside the animator in unity the character changes position.
Here's the images, first one is a gif with the animation running as I want, and then the before and after of the animation in Unity.
I know it's small but I hope you can see
This is because it's setting the center point at the location, and the gif is wider than the standard player image, you will need to offset to compensate.
So I just sliced the sprites again but with the pivot to the left instead of center, and then adjusted the Collider. It seems to work. Not sure if it's the perfect way though.

Thee.js. textures from canvas refers to the lastone

I'm creating some textures for a tiled map.
I have 10 images. I put every one on canvas (to see it), then create a texture from canvas.
I think there is some persitent link to the canvas because the 10 textures created are equal to another (the last one).
Are three.js saving some information relative to the canvas and the 'neeedsUpdate' means that the same canvas is used ? (and if the process is fast I have the same canavas image for every one of 10 ?)
Any idea ? Thanks

Preload animation in JavaFX 2.0

My Problem: I have a complex GridPane. I want to make an overview-scene with nine of these GridPanes. On mouseclick they should scale over the hole scene. So far I had no problem, but when I click on an GridPane it doest about 2 sec nothing and than it it scaled. When I have done this about 10 times it does the animation more or less fluid smooth.
I tried to convert the GridPanes in Images with this: http://blog.ngopal.com.np/2011/10/26/save-node-to-image-in-javafx-2-0/. The Problem is, that in my case this solution is not working.
So is there a possibility to make the GridPane to an image OR preload the animation, so that it is smooth animated on the first cilck?
I have solved the problem by reducing the complexity of the GridPane. (I use Images instead of an overlayeffect)

Flash animation help

I am a complete novice when coming to using Flash but I am looking to create an animation similar to the line into text animation at:
http://www.louisebradley.co.uk/fl/
where instead of running from the top of the screen I want the line to effectively stretch across my homepage horizontally.
I have created an animated gif that does the job but it takes a long time to stretch across 974 pixels in width, and if the frames are reduced it takes away any smoothing effect. I did this in photoshop by simply creating 20 or so frames, each increasing the size of the line by 60 pixels until the full page is covered.
Would I be better off creating the effect in Flash? And if so, where on earth do I start!! Would tweening do this, and how I would I implement it?
Thanks in advance for any help!
I am assuming you are talking about the line to the left of the main navigation? If this is the case, this is being done using a mask that is tweened. You can simply draw out the shape you want "wiped" across the screen and than on the layer above it, draw a box over the shape to be animated. Right click the layer the box is on and select "mask". You can now tween the mask to move from right to left over the shape you drew and it will appear to wipe over. Just remember, whatever the mask is currently over, is what will show through from the layer that is masked. Think of the mask as a window. This can be completely done without actionscript and only using the timeline.

What are the pros and cons of a sprite sheet compared to an image sequence?

I come from a 2D animation background and so when ever I us an animated sequence I prefer to use a sequence of images. To me this makes a lot of sense because you can easily export the image sequence from your compositing/editing software and easily define the aspect.
I am new to game development and am curious about the use of a sprite sheet. What are the advantages and disadvantages. Is file size an issue? - to me it would seem that a bunch of small images would be the same as one massive one. Also, defining each individual area of the sprites seems time cumbersome.
Basically, I dont get why you would use a sprite sheet - please enlighten me.
Thanks
Performance is better for sprite sheets because you have all your data contained in a single texture. Lets say you have 1000 sprites playing the same animation from a sprite sheet. The process for drawing would go something like.
Set the sprite sheet texture.
Adjust UV's to show single frame of animation.
Draw sprite 0
Adjust UV's
Draw sprite 1
.
.
.
Adjust UV's
Draw sprite 998
Adjust UV's
Draw sprite 999
Using a texture sequence could result in a worst case of:
Set the animation texture.
Draw sprite 0
Set the new animation texture.
Draw sprite 1
.
.
.
Set the new animation texture.
Draw sprite 998
Set the new animation texture.
Draw sprite 999
Gah! Before drawing every sprite you would have to set the render state to use a different texture and this is much slower than adjusting a couple of UV's.
Many (most?) graphics cards require power-of-two, square dimensions for images. So for example 128x128, 512x512, etc. Many/most sprites, however, are not such dimensions. You then have two options:
Round the sprite image up to the nearest power-of-two square. A 16x32 sprite becomes twice as large with transparent pixel padding to 32x32. (this is very wasteful)
Pack multiple sprites into one image. Rather than padding with transparency, why not pad with other images? Pack in those images as efficiently as possible! Then just render segments of the image, which is totally valid.
Obviously the second choice is much better, with less wasted space. So if you must pack several sprites into one image, why not pack them all in the form of a sprite sheet?
So to summarize, image files when loaded into the graphics card must be power-of-two and square. However, the program can choose to render an arbitrary rectangle of that texture to the screen; it doesn't have to be power-of-two or square. So, pack the texture with multiple images to make the most efficient use of texture space.
Sprite sheets tend to be smaller
files (since there's only 1 header
for the whole lot.)
Sprite sheets load quicker as there's
just one disk access rather than
several
You can easily view or adjust multiple frames
at once
Less wasted video memory when you
load the whole lot into one surface
(as Ricket has said)
Individual sprites can be delineated by offsets (eg. on an implicit grid - no need to explicitly mark or note each sprite's position)
There isn't a massive benefit for using sprite sheets, but several small ones. But the practice dates back to a time before most people were using proper 2D graphics software to make game graphics so the artist workflow wasn't necessarily the most important thing back then.

Resources