Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

How can i code cross-fading?!

I've read some tuts about this subject (denthor etc.)

and i understand the idea but my knowledge lacks in details...

Its easy to change one palette to another but what about

the picture? How can i change that? I tried to change rgb-values smoothly

and change the current palette every single frame but with no success...




Comments

  • Hi,


    I once made a crossfade routine, which requires two 16-color images, generates two 256-color palettes and one new image. The new image is generated in such a way that each different combination of colors from the source images has its own palette entry in the 256-color palette. This way you can draw the generated image, and then you only have to 'crossfade' the two palettes, which is very easy. You probably already know all this, because I think I have that same tutorial you mentioned. But the trick is that you only have to draw the image (the generated one) on screen once, and to actually crossfade, all you do is slide form one palette to the other.

    If you want the source of my version you can email me (I'll place some more comments before I send it :) I don't know which language you program in, but my version is in C. Note that it is a very rough implementation at this time. It just reads two 'raw' rgb-images, assumed to be 320*200, and no more than 16 different rgb values. It creates the 16-color palettes as it reads the rgb values from each image, then it generates the 256-color palettes and the 'cross-image', draws it and starts sliding the palette.


    Greets,

    Mark




    : I've read some tuts about this subject (denthor etc.)

    : and i understand the idea but my knowledge lacks in details...

    : Its easy to change one palette to another but what about

    : the picture? How can i change that? I tried to change rgb-values smoothly

    : and change the current palette every single frame but with no success...





  • : Hi,


    : I once made a crossfade routine, which requires two 16-color images, generates two 256-color palettes and one new image. The new image is generated in such a way that each different combination of colors from the source images has its own palette entry in the 256-color palette. This way you can draw the generated image, and then you only have to 'crossfade' the two palettes, which is very easy. You probably already know all this, because I think I have that same tutorial you mentioned. But the trick is that you only have to draw the image (the generated one) on screen once, and to actually crossfade, all you do is slide form one palette to the other.

    : If you want the source of my version you can email me (I'll place some more comments before I send it :) I don't know which language you program in, but my version is in C. Note that it is a very rough implementation at this time. It just reads two 'raw' rgb-images, assumed to be 320*200, and no more than 16 different rgb values. It creates the 16-color palettes as it reads the rgb values from each image, then it generates the 256-color palettes and the 'cross-image', draws it and starts sliding the palette.


    : Greets,

    : Mark


    :

    : : I've read some tuts about this subject (denthor etc.)

    : : and i understand the idea but my knowledge lacks in details...

    : : Its easy to change one palette to another but what about

    : : the picture? How can i change that? I tried to change rgb-values smoothly

    : : and change the current palette every single frame but with no success...




    I think I know how to code a 16-color crossfading too, but I'm after the big one! So I'd like to learn how to code 256-color crossfading (just like denthor in his tut :) ). But I still would

    appreciate if u sent your creation to me...




  • : I think I know how to code a 16-color crossfading too, but I'm after the big one! So I'd like to learn how to code 256-color crossfading (just like denthor in his tut :) ). But I still would

    : appreciate if u sent your creation to me...


    I don't think that crossfading two 256 color images with a 256-color screen mode is possible (at least not fast enough). During the transition, you would have to slide 256 different colors to 256 totally new colors, which would give you 65536 possible combinations. You can create a true color image each frame and quantise it to 256 colors, but there is no way that this is fast enough for a crossfade. Are you sure that Denthor used two 256 color images?


    Mark


  • : : I think I know how to code a 16-color crossfading too, but I'm after the big one! So I'd like to learn how to code 256-color crossfading (just like denthor in his tut :) ). But I still would

    : : appreciate if u sent your creation to me...


    : I don't think that crossfading two 256 color images with a 256-color screen mode is possible (at least not fast enough). During the transition, you would have to slide 256 different colors to 256 totally new colors, which would give you 65536 possible combinations. You can create a true color image each frame and quantise it to 256 colors, but there is no way that this is fast enough for a crossfade. Are you sure that Denthor used two 256 color images?


    : Mark


    Denthor did it. If you want to I can send you the tut and the example .exe...




Sign In or Register to comment.