.GIF Images or Animating Images
by Robert Fritzen · in Torque 3D Professional · 08/30/2013 (10:05 am) · 18 replies
Title's got it, I'm looking to create animated image sequences for my GUI's. I want to as much as possible avoid needing to create lots of .png's to replace what a animated .gif could do.
So, thinking file space conservation here, what's the best way to go about doing this? If someone's got .GIF working, it would be extremely beneficial to share what you've got.
So, thinking file space conservation here, what's the best way to go about doing this? If someone's got .GIF working, it would be extremely beneficial to share what you've got.
About the author
Illinois Grad. Retired T3D Developer / Pack Dev.
#2
I'm not sure how hard it would be to bring in a new image format to the engine. It looks like there's quite a lot of work to be done to do that. I'll do some more research.
08/30/2013 (4:34 pm)
I'm not sure, I've only tried bringing in animated GIF's and they don't even show on the GUI controls. I'm not sure how hard it would be to bring in a new image format to the engine. It looks like there's quite a lot of work to be done to do that. I'll do some more research.
#3
08/30/2013 (7:08 pm)
If MNG is supported in libpng then it shouldn't be real tough - just have to get the asset system and resource manager to handle them correctly. Which you'd have to do anyway, but at least the image format is already available through the png library....
#4
08/31/2013 (2:00 am)
Is an animated GIF already patent free?
#5
bitmapMng.cpp
I'm not sure if it will run the animations though, I'll generate a test image to see if it does.
08/31/2013 (3:15 pm)
Well, the good news is it looks like T3D is already loaded with MNG support:bitmapMng.cpp
static struct _privateRegisterMNG
{
_privateRegisterMNG()
{
GBitmap::Registration reg;
reg.extensions.push_back( "jng" );
reg.extensions.push_back( "mng" );
reg.readFunc = sReadMNG;
reg.writeFunc = sWriteMNG;
GBitmap::sRegisterFormat( reg );
}
} sStaticRegisterMNG;I'm not sure if it will run the animations though, I'll generate a test image to see if it does.
#6
08/31/2013 (3:38 pm)
I was hoping it was already setup for that. Way to check this out Robert!
#7
GIF has been patent free since 2004. More precisely the LZW algortihm that GIF relies on has been patent free since 2004. However, PNG has a better compression algorithm and can actually produce smaller images if you use an indexed mode like GIF uses. The problem is very little adoption of MNG has occurred so it has not replace the animated GIFs.
08/31/2013 (3:40 pm)
@Nils,GIF has been patent free since 2004. More precisely the LZW algortihm that GIF relies on has been patent free since 2004. However, PNG has a better compression algorithm and can actually produce smaller images if you use an indexed mode like GIF uses. The problem is very little adoption of MNG has occurred so it has not replace the animated GIFs.
#8
Either way, I can't test this any further than that, so if someone else can generate a animated MNG/JNG file, please test it and see if the engine supports animated images.
08/31/2013 (3:51 pm)
Well, either my copy of Photoshop Elements cannot produce the animation sequence for the specific file, or T3D doesn't support animated images (which would suck, alot).Either way, I can't test this any further than that, so if someone else can generate a animated MNG/JNG file, please test it and see if the engine supports animated images.
#9
demolishun.net/images/warTest.mpg
demolishun.net/images/warTest.gif
demolishun.net/images/warTest.mng
The first link is in mpg, the second in gif, and the third in mng. Ironically I have nothing that can produce a mng from an mpg. I had to use a video converter to go from mpg to gif. Then in GIMP I used the gif and produced the mng. I cannot even play the mng as I have nothing to play it. LOL! Hopefully T3D can. At least you can see what it is supposed to do with the other two files. Also, try the mpg, you never know. Or convert it to the video format that T3D does support (can't remember the name).
08/31/2013 (5:46 pm)
Here you go:demolishun.net/images/warTest.mpg
demolishun.net/images/warTest.gif
demolishun.net/images/warTest.mng
The first link is in mpg, the second in gif, and the third in mng. Ironically I have nothing that can produce a mng from an mpg. I had to use a video converter to go from mpg to gif. Then in GIMP I used the gif and produced the mng. I cannot even play the mng as I have nothing to play it. LOL! Hopefully T3D can. At least you can see what it is supposed to do with the other two files. Also, try the mpg, you never know. Or convert it to the video format that T3D does support (can't remember the name).
#10
This is quite disappointing.
08/31/2013 (5:51 pm)
Either the .mng is broken or T3D doesn't support animations (it was black).This is quite disappointing.
#11
I downloaded vsstudio2012 and attempted to run a debug build as there is a file:
C:\Torque\Torque 3D 1.2\Engine\source\gfx\bitmap\loaders\bitmapMng.cpp and .h
included in torque by default. The problem, I can't run the debug build as I am getting 763 warnings and 862 errors. (stock project with no changes)
I'll have to look into the errors to see if I can get torque to build. (haven't worked on building a torque project since downgrading to windows8 )
09/01/2013 (11:09 am)
I decided to check this out as paint shop pro animation shop exports to mng, plus, there are a bunch of mng files included. I didn't get a black screen, just an error telling me that it is unsupported.I downloaded vsstudio2012 and attempted to run a debug build as there is a file:
C:\Torque\Torque 3D 1.2\Engine\source\gfx\bitmap\loaders\bitmapMng.cpp and .h
included in torque by default. The problem, I can't run the debug build as I am getting 763 warnings and 862 errors. (stock project with no changes)
I'll have to look into the errors to see if I can get torque to build. (haven't worked on building a torque project since downgrading to windows8 )
#12
09/01/2013 (1:29 pm)
@Demolishun, Nero Photosnap Viewer is showing the .mng as a single unanimated gameboard, thats not to say its not animated just all I can get out of a .mng is a still. (just for info)
#13
Will be testing out a supported mng file thru the debugger soon.
09/01/2013 (3:50 pm)
Animation shop (paint shop pro) shows the animations, but mng doesn't support transperancies. (found the problem with the error messages)Will be testing out a supported mng file thru the debugger soon.
#14
09/01/2013 (6:00 pm)
Man, maybe we should just stick IFL back in....
#15
@Robert; "Photoshop Elements cannot produce the animation sequence" - Adobe(R) is selling Fireworks for that,
but it doesn't support mng.
Is there perhaps a way to use T3D's Image Sequence Animation code with GUI objects?
09/01/2013 (6:59 pm)
@Demolishun; I ment the rights for animated GIF. I thought it was still unclear. But I'm not an expert on this subject :)@Robert; "Photoshop Elements cannot produce the animation sequence" - Adobe(R) is selling Fireworks for that,
but it doesn't support mng.
Is there perhaps a way to use T3D's Image Sequence Animation code with GUI objects?
#16
Man, I just wish animated GIFs were supported, that would make life so easy here.
09/01/2013 (8:00 pm)
I have no idea where the Image Sequence Animation code is even located for starters, and then that would introduce the questions of does it support MNG/GIF, and if not does it require loads of images to make the sequence (which I am trying to avoid).Man, I just wish animated GIFs were supported, that would make life so easy here.
#17
However this is developed to be used in materials. I'm not a programmer so I just raise the question whether it would be possible to use that code. If so, you can also think about replacing the multiple files used in GUI button states.
09/01/2013 (8:18 pm)
@Robert; T3D's Image Sequence Animation (see Artist Primer) has been developed to replace IFL (multiple files). It's a single file containing all the "slides" placed next to each other and can be in one of supported file formats like PNG, JPG, or DDS. With TS like this you can set the amount of frames and the speed:singleton Material(
{
diffuseMap[0] = "art/shapes/examples/image_sequence";
sequenceSegmentSize = 1 / 6; // 1 / numFrames
sequenceFramePerSec = 1;
};However this is developed to be used in materials. I'm not a programmer so I just raise the question whether it would be possible to use that code. If so, you can also think about replacing the multiple files used in GUI button states.
#18
I have found one or two libraries that "claim" to offer animated .gif support. I'm going to take the long and hard road here of actually placing in this new library and getting T3D to load in the GIF's by the new library instead. I'll also have a look at the Image Sequence code before I actually dive into the resource manager re-writes to make sure I can't just do it by that.
09/10/2013 (3:47 pm)
I've been looking more into this and apparently the reason we can't do it is, well quite simply there are almost no C++ libraries out there to handle loading animated GIFs, which is quite surprising seeing as it's one of the most popular image formats for doing animation.I have found one or two libraries that "claim" to offer animated .gif support. I'm going to take the long and hard road here of actually placing in this new library and getting T3D to load in the GIF's by the new library instead. I'll also have a look at the Image Sequence code before I actually dive into the resource manager re-writes to make sure I can't just do it by that.
Torque Owner Demolishun
DemolishunConsulting Rocks!
Does GIF suffer from color support? I thought it was an indexed format rather than an RGB[A] formatted image file.