animated textures
Blitz3D Forums/Blitz3D Programming/animated textures
| ||
I am looking at incoerporating some animated sprites. I assume the only way to do this is by using createsprite with animated textures ? If this is the case can anyone point me in the right direction where I can get some software to create "animated strips" from my single images. |
| ||
Personally i use paint :) Pretty basic, but it gets the job done for me. |
| ||
Is there a particular size or format for each image which works best ? |
| ||
Well, your textures (images) should be a power of two for height and width. I'm talking about one frame here mind. So one frame of animation should be: Height: 2,4,8,16,32,64,128,256,512 etc etc Width : 2,4,8,16,32,64,128,256,512 etc etc try and keep the ratio of height to width under 8:1 and vise-versa. Png is usually very good for textures, as it has good compression and lossless compression, unlike jpg. Bitmap file format is ok to use too, as in memory, the texture is converted to an uncompressed image, so the difference between png ,bmp and jpg is nothing. So keep you textures to a square power (single frame, the whole texture strip can be what you want), and i think png is the best texture format to use. Some ppl use tiff, as it has an alpha channel :) |
| ||
try and keep the ratio of height to width under 8:1 and vise-versa. That's interesting.. I didn't know that could matter. What's the reasoning behind this? |
| ||
Mustang mentioned something about this distorting the texture, and since he works for FutureMark, i heeded the advice. I'm not quoting him on it tho, but i remember him saying something along those lines :) |
| ||
Here is a simple technique for creating an animstrip: ;TotalWidth=Individual Frame Width*Number of Frames in total TotalWidth=NumberofFrames*SpriteWidth MyImage=CreateImage(TotalWidth,Height) Dim MyFrame(NumberOfFrames) for i=1 to NumberOfFrames MyFrame(i)=loadimage("FileName in some format that includes a numeric identifier") ;Such as MyBitmap1.bmp, MyBitmap2.bmp MyBitmap3.bmp ;which can be loaded as MyFrame(i)=loadimage("MyBitmap"+Str(i)+".bmp") ; setbuffer imagebuffer(MyImage) DrawImage MyFrame(i),(i-1)*ImageWidth(MyFrame(i)),0 next saveimage (MyImage,"Filename.bmp") end |