Page 1 of 2

Dissolve effect source?

PostPosted: Sep 27, 2003 @ 3:04am
by fzammetti

PostPosted: Sep 27, 2003 @ 3:09am
by mlepage

PostPosted: Sep 27, 2003 @ 7:44am
by DillRye

PostPosted: Sep 27, 2003 @ 1:47pm
by fzammetti

PostPosted: Sep 27, 2003 @ 3:57pm
by mlepage
DillRye's approach also would work, although you'd want to ensure that you actually make steady progress from one image to another.

My approach has the property of making 64 equal steps toward the other image, each step being 1/64 closer.

There's probably smarter ways to do it, but that's off the top of my head.

PostPosted: Sep 28, 2003 @ 12:18am
by vic

PostPosted: Sep 28, 2003 @ 2:15am
by mlepage

PostPosted: Sep 28, 2003 @ 5:04am
by fzammetti

PostPosted: Sep 28, 2003 @ 5:06am
by fzammetti

PostPosted: Sep 28, 2003 @ 6:19am
by mlepage

PostPosted: Sep 28, 2003 @ 11:49pm
by vic
if you're willing to waste memory just load a non grayscale image which is still a grayscale image on a higher bitdepth and just load a color channel to compare values with..

i just made a working example here. ill put up a example, meanwhile just follow this code:

/////////////////////////////////////////////////////////////
// Dissolve effect
/////////////////////////////////////////////////////////////

WORD *texdata = (WORD *)pTex->GetData();
BYTE *b_mapdata = (BYTE *)pHeightMap->byteData;
WORD *w_mapdata = (WORD *)pHeightMap->GetData();

if( bDissolve )
{
int map_index = 0;
for( j=0; j<backbuf.dwHeight; j++ )
{
WORD *line = buffer;
for( i=0; i<backbuf.dwWidth; i++ )
{
if( b_mapdata[map_index] > h )
{
WORD pixel = *(texdata + i + j*pTex->GetWidth());
*line = pixel;
}

line += xpitch;
map_index++;
}

buffer += ypitch;
}

// effect is over
h++;
if( h == 255 ) bDissolve = FALSE;
}

PostPosted: Sep 29, 2003 @ 2:06am
by vic

PostPosted: Sep 29, 2003 @ 2:11am
by fzammetti

PostPosted: Sep 29, 2003 @ 3:06am
by vic

PostPosted: Sep 29, 2003 @ 3:09pm
by Presto
You might want to check this out too... It's a disintigration effect.

Say you use 30 FPS, and you want to disintegrate the entire screen over 3 seconds. That gives us 90 frames to work with.

[pseudocode]
Create an integer "scrn_array" for the number of pixels/blocks you want to dissolve.

Assign every integer in the array a random number from 1-90.

Take a snapshot of the current screen.

Start the frame_counter at 1.

Loop through the scrn_array.

If our "scrn_array[x][y] == frame_counter", blank out that pixel/block in the snapshot.

Next

Increment frame_counter.

Update the screen with the modified snapshot.
[/pseudocode]

Looping through per pixel would be about 853 pixel changes per frame (76,800/90). That's a lot, but if we use 2x2 blocks, it's only 213 changes (19200/90). 4x4 blocks would be 53 changes (4800/90) per frame. And 8x8 blocks would yield 13 changes per frame (1200/90).

So, as always it's a speed vs. quality decision.

I'll have to try this myself sometime.