Welcome, Guest. Please login or register.

What openbor you prefer: Double dragon,battletoads or final fight !? by lirexpatrio
[December 07, 2012, 07:15:27 pm]


what are your favorite games OpenBOR?! by lirexpatrio
[December 07, 2012, 07:09:46 pm]


Post Some Awesome Videos by maxman
[December 07, 2012, 05:51:39 pm]


Can @cmd playmusic "aaaa" 1 also increse music sound ? by BeasTie
[December 07, 2012, 05:24:38 pm]


Streets of Rage: Silent Storm by mtrain
[December 07, 2012, 03:45:05 pm]


Site will be down for maintenance on 12/8/2012 thru 12/10/2012 by Damon Caskey
[December 07, 2012, 07:42:42 am]


Cancelled SOR 3d Remake by riccochet
[December 07, 2012, 03:58:33 am]


Dungeon Fighter: B.O.R. by msmalik681
[December 07, 2012, 03:24:27 am]


[TUTORIAL] How to create 4 Games of OpenBOR in 1 CD (650 MB) by magggas
[December 06, 2012, 09:46:25 pm]


custknife by Bloodbane
[December 06, 2012, 09:34:09 pm]


blockfx help by B.Kardi
[December 06, 2012, 04:09:14 pm]


street of age 4 hd by corradlo
[December 06, 2012, 01:41:36 pm]


ClaFan - Classic Fantasy ver 1.17 by soniczxblade
[December 06, 2012, 05:01:20 am]


Bug Archive by Bloodbane
[December 06, 2012, 02:00:44 am]


"Bio-Doom" and "Gears of Doom" by BulletBob
[December 05, 2012, 10:07:21 pm]


Contra Locked 'N' Loaded v2 by Bloodbane
[December 05, 2012, 09:39:43 pm]


Downloadable OpenBoR Manual by BeasTie
[December 05, 2012, 08:31:24 pm]


Having trouble testing changes by B.Kardi
[December 05, 2012, 03:05:53 pm]


DragonBall Absalon by msmalik681
[December 05, 2012, 02:52:13 pm]


[Hi-Res] Swamp by Vibrant
[December 05, 2012, 10:47:14 am]


  • Dot Guests: 166
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.



Author Topic: mng Animation and other alternates  (Read 2849 times)

0 Members and 1 Guest are viewing this topic.

Offline utunnels

  • Developer
  • Hero Member
  • *****
  • Posts: 2713
Re: mng Animation and other alternates
« Reply #15 on: April 07, 2011, 02:16:05 am »
Another problem is 16bit/24bit conversion.
No matter the frames are in 8bit/palette mode or 24 bit color mode, it has to match current screen format.

Problem is, how fast it would be when converting palette into 16 bit. Since each frame has an individual palette, it must be done every frame. If the frames are in 24bit mode, it is even worse since we have to do that conversion for every pixel.

I know SDL has a feature that allows a 32 bit surface to be drew on a 16 bit surface (though it maybe be slow), but what about consoles? :eek:

Offline Bloodbane

  • Hero Member
  • *****
  • Posts: 7113
  • Dark Dragon
Re: mng Animation and other alternates
« Reply #16 on: April 10, 2011, 12:41:17 am »
Quote
Problem is, how fast it would be when converting palette into 16 bit. Since each frame has an individual palette, it must be done every frame.

 .mng frames have its own palette?
OpenBoR Manual

Basic OpenBoR Tutorials

OpenBoR Tricks & Tutorials

"The more often enemies attack, the more open they are to counter attacks"

Offline utunnels

  • Developer
  • Hero Member
  • *****
  • Posts: 2713
Re: mng Animation and other alternates
« Reply #17 on: April 10, 2011, 01:23:08 am »
Hmm, I was talking about generic custom format.

But as for MNG, yeah.

Quote from: http://www.libpng.org/pub/mng/spec/#mng-PLTE
4.2.2. PLTE and tRNS Global palette

The PLTE chunk has the same format as a PNG PLTE chunk. It provides a global palette that is inherited by PNG datastreams that contain an empty PLTE chunk.

The tRNS chunk has the same format as a PNG tRNS chunk. It provides a global transparency array that is inherited along with the global palette by PNG datastreams that contain an empty PLTE chunk.

If a PNG datastream is present that does not contain an empty PLTE chunk, neither the global PLTE nor the global tRNS data is inherited by that datastream.

If the global PLTE chunk is not present, each indexed-color PNG in the datastream must supply its own PLTE (and tRNS, if it has transparency) chunks.

The global PLTE chunk is not permitted in MNG-VLC datastreams.
« Last Edit: April 10, 2011, 01:25:41 am by utunnels »

Offline Plombo

  • Hero Member
  • *****
  • Posts: 1724
  • Your source for useful modding tools!
Re: mng Animation and other alternates
« Reply #18 on: April 10, 2011, 09:17:23 pm »
Another problem is 16bit/24bit conversion.
No matter the frames are in 8bit/palette mode or 24 bit color mode, it has to match current screen format.

Problem is, how fast it would be when converting palette into 16 bit. Since each frame has an individual palette, it must be done every frame. If the frames are in 24bit mode, it is even worse since we have to do that conversion for every pixel.

I know SDL has a feature that allows a 32 bit surface to be drew on a 16 bit surface (though it maybe be slow), but what about consoles? :eek:

Ouch, that's a good point.  I didn't even think of that.

And if we tried using RGB images in 16/32-bit mode, one problem we would have is consoles that have the color components in reverse order: RGB instead of the typical BGR.  The Wii is currently the only one, but I seem to remember it being required by OpenGL ES 1.0 as well.



Those two issues pretty much kills .mng, doesn't it?  Now that you've brought that up, I think APNG might be worth a look.  It's an extended PNG format created by Mozilla as an alternative to MNG.  If I'm reading its specification correctly, it doesn't have the problem of each frame having its own palette.

From the APNG specification:
Quote
`fdAT`: The Frame Data Chunk

The `fdAT` chunk has the same purpose as an `IDAT` chunk. It has the same structure as an `IDAT` chunk, except preceded by a sequence number.

At least one `fdAT` chunk is required for each frame. The compressed datastream is then the concatenation of the contents of the data fields of all the `fdAT` chunks within a frame. When decompressed, the datastream is the complete pixel data of a PNG image, including the filter byte at the beginning of each scanline, similar to the uncompressed data of all the `IDAT` chunks. It utilizes the same bit depth, color type, compression method, filter method, interlace method, and palette (if any) as the default image.

There is only one "default image" in an APNG; it's the image displayed by PNG viewers that do not support the APNG extension.  So all APNGs with palettes use the same palette for the entire thing.

The biggest problem with APNG that I can think of is that it would require us to use Mozilla's modified libpng library instead of the official one.  But I don't think that's too problematic; we would just have to compile one additional library, and include it as a static library in SVN, for each platform.
« Last Edit: April 10, 2011, 09:23:45 pm by Plombo »

Offline utunnels

  • Developer
  • Hero Member
  • *****
  • Posts: 2713
Re: mng Animation and other alternates
« Reply #19 on: April 11, 2011, 02:45:41 am »
Well, each frame has its own palette is a actually a good feature IMO.

The purpose of this topic (and it seems DC didn't mention it in the first post), is rendering animations that can break the 256 color limit of gif.

Now I'm curious (I haven't tested a thing so far), what performance we could get if the engine copies pixels one by one, like when it does alpha blending for 16 bit mode.

Say, a 24bit frame is drawn to a 16bit screen, then each pixel is done like this:
Quote from: pixelformat.c
unsigned short colour16(unsigned char r, unsigned char g, unsigned char b)
{
    return ((b&0xF8)<<8) | ((g&0xFC)<<3) | (r>>3);
}

And under 32 bit mode, it is like this:
Quote from: pixelformat.c
unsigned colour32(unsigned char r, unsigned char g, unsigned char b)
{
    return ((b<<16) | (g<<8) | r);
}




Custom format I mentioned above is something like the entity definition.

For example, it can use frame command to define a frame, use delay command to define frame delay.

So, we can just change an entity.txt to an animation.txt, giving it a special flag to stop the engine from loading any images. When the animation is requested as a cut scene, the engine will load the frames one by one.
« Last Edit: April 11, 2011, 02:51:00 am by utunnels »

Offline Plombo

  • Hero Member
  • *****
  • Posts: 1724
  • Your source for useful modding tools!
Re: mng Animation and other alternates
« Reply #20 on: April 11, 2011, 12:03:22 pm »
Well, each frame has its own palette is a actually a good feature IMO.

The purpose of this topic (and it seems DC didn't mention it in the first post), is rendering animations that can break the 256 color limit of gif.

Now I'm curious (I haven't tested a thing so far), what performance we could get if the engine copies pixels one by one, like when it does alpha blending for 16 bit mode.

Say, a 24bit frame is drawn to a 16bit screen, then each pixel is done like this:
Quote from: pixelformat.c
unsigned short colour16(unsigned char r, unsigned char g, unsigned char b)
{
#if WII
   return ((r&0xF8)<<8 ) | ((g&0xFC)<<3) | (b>>3);
#else
   return ((b&0xF8)<<8 ) | ((g&0xFC)<<3) | (r>>3);
#endif
}

And under 32 bit mode, it is like this:
Quote from: pixelformat.c
unsigned colour32(unsigned char r, unsigned char g, unsigned char b)
{
#if WII
   return ((r<<16) | (g<<8 ) | b);
#else
   return ((b<<16) | (g<<8 ) | r);
#endif
}

Fixed those for you.  The versions you included in your post were outdated.  Your point still stands, though. :)

Custom format I mentioned above is something like the entity definition.

For example, it can use frame command to define a frame, use delay command to define frame delay.

So, we can just change an entity.txt to an animation.txt, giving it a special flag to stop the engine from loading any images. When the animation is requested as a cut scene, the engine will load the frames one by one.

Whoops, forgot about the custom format.  I have an addition to that: why don't we add something like the palette command as well?

At first I thought it should just be defined like it is for entities, allowing the modder to change palettes in mid-movie by pointing to a different frame.  But now that I think about it, I think it would be better to have a merged command, pframe, which would define a frame that changes the current palette.  That way, if the modder wants to change palettes on every frame, they can do it with less of a  performance hit, at least in theory.

Another thing to consider is motion compensation.  Animated GIF, and I assume MNG and APNG, allow defining only the part of a frame that's changed from the previous frame.  We could do this by having optional fields for the X and Y offset of each frame.

Offline utunnels

  • Developer
  • Hero Member
  • *****
  • Posts: 2713
Re: mng Animation and other alternates
« Reply #21 on: December 04, 2011, 01:56:42 am »
http://en.wikipedia.org/wiki/Theora
http://www.theora.org/

Just a thought. Since we already have ogg audio format support, how practicable would it be to implement a video support?

Offline BeasTie

  • Hero Member
  • *****
  • Posts: 760
Re: mng Animation and other alternates
« Reply #22 on: December 04, 2011, 02:34:24 am »
That looks pretty good,

Id love to see a format that would allow audio into the video.
What if openbor could use some kind of external player thats open license, you ever played a game that uses that bink player to run videos externally? Then the only code to add in openbor would be a command to let you launch a video in the player instead of a .gif.

just using this as an example cause i've seen it before
http://www.radgametools.com/bnkdown.htm

i know you guys are more thinking of 16/32 bit support, but I've often imagined being able to script gif animations inside openbor, so the animations .txt file would allow you to cue sound effects at exact times or frames of animations.  Or even further be able to build an animation 'scene' much like stages are done, where 'entities' could be used. (you guys have prob something like the latter with script i'd guess thou)

Also Im sure .avi support or something has licence issues or something but the opening animation for my mod which is a few minutes long is about 3mb+ as processed .avi and about 6mb+ as .gif so maybe straight up video support of some format could be the go, or are you actually thinking it would be used to have a custom format for openbor ?

just my ideas, sorry to interject.

 



 0%




mighty
SimplePortal 2.3.3 © 2008-2010, SimplePortal