What's this effect called?

BlitzMax Forums/BlitzMax Programming/What's this effect called?

RetroRusty(Posted 2010) [#1]
Hi,

Does anyone know what the effect is called in the picture below? It basically builds the screen up one line at a time from the bottom until all the picture is shown.

If anyone has a piece of code that does this, could I take a look at it?




Leon Drake(Posted 2010) [#2]
looks like they just take one line of pixels from and image and stretch it down to some point then move tot he next line.


Warpy(Posted 2010) [#3]
not quite - it looks like there are at least two rows of pixels being stretched there. BMax isn't too good at these pixel-manipulation type effects


Czar Flavius(Posted 2010) [#4]
You could make the background an image and use drawimagerect trikery of some kind?


Oddball(Posted 2010) [#5]
Load the image as an AnimImage with each full horizontal line as a frame. Then to draw you simply add lines/frames from the bottom to the top each flip. To get the stretch effect draw the current top frame to fill the rest of the screen.

And because I'm feeling generous here's the code.




ImaginaryHuman(Posted 2010) [#6]
This effect was done easily on the Amiga using the copperlist, whereby you could point each row of the video scan beam to read a specific row of pixels from memory, creating basically a vertical zoom. Usually there was only one row stretched the entire height between the top of the progressed image and the top of the screen, but as in Total Recall, some folks started to show more than one row stretched out because then it had more of a vertical movement to it.

There's another easyish way to do this.

Just load the whole image once. Then SetScale to some high number in Y. Draw the stretched image at an appropriate scroll offset vertically. Then draw a rectangle from the original image on top of it at the bottom of the screen. I forget that new command, DrawImageRect or something?


Czar Flavius(Posted 2010) [#7]
Oddball, each 1-line frame would use a ton of video memory as frames are stored as squares internally!


Oddball(Posted 2010) [#8]
Really? I tried it with a 2448x1308 image and it used less vram than loading the image as one. What's your basis for that statement?


xlsior(Posted 2010) [#9]
IIRC they aren't stored as squares, but as nearest-power-of-2.

So a single pixel tall slice of an 2448x1308 image should be stored as a 4096 x 2 image in video memory, with bytes per pixel = 4096 x 2 x 4 = 32 KB

loading the entire image as one would take up 4096 x 2048 x 4 = 32 MB


Czar Flavius(Posted 2010) [#10]
Oh I apologise, I thought it was nearest-(highest!)-power-two in a square not rectangle, thanks for this information.

Oddball, how do you measure video memory usage?


SLotman(Posted 2010) [#11]
Wouldn't it be easier to just manipulate the UV coords of the quad? I remember on OpenGL you can use GL_CLAMP to achieve something similar to this...

Yeah, look here to see a sample! (scroll down until you see the clamped images sample)

Direct-X should have a similar thing, but I don't remember the actual process to do it. The really good thing about this, is that it has 0 cost on processor speed, neither do you have to store several images or draw the image several times with drawimagerect.


jkrankie(Posted 2010) [#12]
I'd be looking at using GL for this effect.

Cheers
Charlie


SLotman(Posted 2010) [#13]
Here, I just hacked Nehe sample 6 to simulate the effect:



I had to do with 2 quads instead of one... but still, much better than drawing several times the same thing :)


Oddball(Posted 2010) [#14]
Erm... You do know you can do that using Max2D? There's no need for any hacky OpenGL nonsense.



Oddball(Posted 2010) [#15]
And just to make it feature complete here it is with the multi-line stretch effect shown in the original post.


smilertoo(Posted 2010) [#16]
years ago i'd have called it a copper stretch.


Czar Flavius(Posted 2010) [#17]
Oddball, how do you calculate vram???


Oddball(Posted 2010) [#18]
@Czar: I use the Instruments app that comes with Mac OS X, but I'm sure if you google though there'll be plenty of other monitoring apps around.


Gabriel(Posted 2010) [#19]
IIRC they aren't stored as squares, but as nearest-power-of-2.

So a single pixel tall slice of an 2448x1308 image should be stored as a 4096 x 2 image in video memory, with bytes per pixel = 4096 x 2 x 4 = 32 KB

loading the entire image as one would take up 4096 x 2048 x 4 = 32 MB


You're quite correct, but it's important to point out that a lot of older hardware has problems with texture width/height ratios of greater than 8:1 or 1:8. So you could well run into compatibility issues with something like this. No idea whether Linux/Mac drivers would be an additional problem. I've found the videocard drivers on MacOS to be pretty dire.