migablitter: How does this tornado effect work ?

category: code [glöplog]
... As there was a recent thread about a mysterious twisty scroller effect from 1988, I was wondering how the pixel displacement worked in this kind of well known blitter effects:

stellar - bananamen - 1993, the tornado fx

... I understand the planes tricks used to have many color, I understand this is just some copy with masking, I understand it must use the special blitter mode for the "1010101" dithering sometimes, I also get that these kinds of displacement create "edge errors", that these errors are then "magnified", and that's a reason why it looks so fractal and great.

What i'm not sure about is the way the pixels are displaced for zoomming and rotating: Is the screen divided in 8 slices, taking 8 blits to move their bits 1 or 2 pixels in a given direction each ?

But then what about the darkroom tornado, it gets perfectly circular at one point:
As I have only a little experience with the blitter, these kinds of effects are really my gap, and I would be glad to have more informations about it. Thx in advance.
added on the 2010-11-24 15:41:34 by krabob krabob
grrr.. corrected second link:
darkroom tornado at some point
added on the 2010-11-24 15:44:03 by krabob krabob
Looks like three effects:

First a LUT-based tunnel/swirly thing.
Then ???
Third, radial blur
(that was a reply for the darkroom tornado)

About the "fractal" tunnel from bananamen, I think it's just a LUT-based tunnel with a clever texture and some color cycling, no realtime fractals there.
yes of course it's "lut" and all, the point is, like for the previous scrolltext thread:

On unexpanded amigas, You can't just move pixels on a bitmap with the CPU, you have to use a special 2D chip called the blitter, and this one can't do much, so you have to trick a lot.

That's why I'm afraid someone who don't have the amiga / atari culture just can't understand my questions :( . Sorry for being oldschool on this one !
added on the 2010-11-24 17:09:59 by krabob krabob
Graga: you're kidding, right? LUT-tunnels at that resolution running 50fps on a500?

krabob; you're more or less right about the rotation, only that it uses more than 8 slices (and more than +/- 2 pixels movement).
It's not a traditional LUT tunnel I think, looks like a fairly ordinary feedback effect. You can see it rendering garbage in the centre as a seed point.

Maybe it's LUT based feedback somehow? But would LUT effect run at this speed and res? Maybe the dithering hides the fact that it's running at half res.
added on the 2010-11-24 17:15:02 by psonice psonice
plus, amiga screens were planar, not chunky: You had 8 pixels per byte in video memory on one plane, so the 4 color tornado just uses 2 planes.
The blitter could operate copy of bitmaps on large areas, possibly using another bitmap for masking (you could use that to fake big sprites, also known as BOBs (blitter objects), with as many masked copies as plane used ). These copies could be used for massive pixel displacements, like for these effects, and what I'm looking for is : how many displacement, what kind of masks are used, etc...
added on the 2010-11-24 17:21:04 by krabob krabob
oops didn't read the 2 previous posts
added on the 2010-11-24 17:22:11 by krabob krabob
krabob: psonice is wrong and I'm right, that's all you need to know.

As for the "perfectly" circular bit in darkroom that can be attributed to the motion blur / blitter smearing
Hey, I was just looking at that particular demo again and had the same wish, to ask how this effect is done. A coinscidence :)
My curiosity is what kind of algorithm is this? It doesn't look to me like a fractal but a simple rotozoomblur but without the blur. Is some noisy stuff generated near the center? What is needed to make those kinds of patterns? I have seen it many times in old demos but can't decide what it is.
added on the 2010-11-24 17:30:20 by Optimus Optimus
Is some noisy stuff generated near the center?

Yes. Some other demo bob's drawn graphic there sometimes.
What is needed to make those kinds of patterns?

that's what I'm also wondering.
Thinking about it, it may be a lot of 16x16 squares, more and more shited out of the center. (Blitter worked with 16 bits multiple blocks, pie slices wouldn't have made good masks). I may stop posting and do some testing after that .... I'm all the more frustrated that I know the sources of that effect were spread a lot at the time. (but I don't have that on my old backups)
added on the 2010-11-24 17:40:17 by krabob krabob
...more and more shifted :)
added on the 2010-11-24 17:41:47 by krabob krabob
Korvkiosken: Wrong about it being feedback, or the LUT stuff? (I figured it wasn't LUT, but could be using LUT somewhere along the line.. big guess here though, I don't know a whole lot about amiga coding :)

optimus: you can get this kind of effect by just rotating and zooming the whole screen each frame and writing some crap in the middle. The crap gets scaled and rotated each frame, because you're not using any filtering there's a lot of error in the scale + rotate, so after a few frames you get some weird shapes like this. That effect looks more complex than normal though (as in the shape), maybe because of the dithering?
added on the 2010-11-24 17:42:41 by psonice psonice
Oh, i was replying to graga's suggestion that it's just a LUT tunnel btw, not you (we were writing at the same time I guess)
added on the 2010-11-24 17:45:08 by psonice psonice
it works like psonice said, tho I wonder if there's enough horsepower to move each pixel using a LUT, so fast, or there's some tricks involved. Dithering is there so it cant be a simple copy this pixel there stuff, also the effect needs 2 buffers, once you move stuff from A to B and then B to A, etc.
added on the 2010-11-24 18:03:25 by Oswald Oswald
Hmm.. in theory it's possible to do this with a single buffer, if you start from the outside and work inwards. That's trading a chunk of memory for a lot of extra complexity though. Probably lots of CPU cycles too.
added on the 2010-11-24 18:17:46 by psonice psonice
Shit, I realized that someone actually gave me the source of that effect some years ago, must be on an old HD... fuck I could I forget that ?
added on the 2010-11-24 18:22:28 by krabob krabob
actually answers are here:
thread on ada, 6 years ago ... great.... so it seems I ask questions, I'm answered, but then I forget and ask again... gonna shoot myself fucking goldfish.
take a look at the prestige cracktro (Mortal Kombat 2) by Stelios/Scoopex :
- after doublebuf, bltcon0/bltapt/bltdpt address computed, the pattern is traced with CPU in work screen. (with bset and bclr ". . . . ." set or clr x4 xNbplane something like that) and bplcon1 shift
here is the shape of pattern. (in this case, it's the same for 4 bitplanes)
- n pieces 32x48 are blitted from work screen to dest screen with computed shift and minterm for bltcon0, and new computed pos for source and dest. the mask is -1

So, I guess , copyed pattern are just rectangles that "or" the destination. As the "shifts" are precomputed, it is strangely similar to the previous thread's scrolltext effect.
added on the 2010-11-24 18:33:50 by krabob krabob
geez I dont get at all the miggy techno babble, how are those patterns used?
added on the 2010-11-24 18:50:54 by Oswald Oswald
fucking patterns, how do they work?
added on the 2010-11-24 21:19:12 by ryg ryg
i did an effect inspired by those fractal zoomers once.. if mine works exactly the same, i'm not sure, but the result is similar..

i divide the screen into 16x16 blocks and for each block i set the blitter dest pointer.. then according to the rotation/zoom/whatever required, i calculate a source coordinate for the blitter source and then blit the block..
each frame some (random?) gfx is plottet at the center (for a zoom-out effect) which gets distorted more and more for each frame..
at least that's the jist of it, i might have forgotten some details, since this was over 10 years ago.
ah, so there is no actual rotation or scaling, but you're basically shifting each 16x16 block so the bitmap is shifted in a spiral pattern? That's starting to sound fast and capable of making these kind of patterns :D
added on the 2010-11-24 22:30:14 by psonice psonice
no actual rotation of any bitmap data, no..

the blitter source coordinate is a pixel coordinate of course, not a block coordinate, otherwise you would just get something that looked like a giant rotating mosaic with no distortion ;-)

and what was said above about blitting from buffer A to B in one frame and then from B to A in the next holds true..
I've done some archeological survey this evening and disassembled/commented the blitloop and parts of the memory map of the tequila 40k intro by stellar, specifically the stellar blitter noise code =)

the loop is @41d10, if you wanna take a look.

when the zoomer first appears, write 52 39 00 04 18 91 to 4181a to prevent the intro from skipping on to the next screen (cheatcode! :D)

the blitloop blits 99 (9x11) times 64x3 words (BLTSIZE=1003), A+D modulo is $2A.
BLTCON0 is x9F0 (enable A+D, copy A miniterm).
"x" (A shift) is dynamic per blit (register value LUT).

4189a stores a pointer to a short fxdat[9*11] array which seems to contain pixel offsets (signed, min=e4ff?, max=1b01?) which are used to calculate ASH and APT per BLIT (read (a1)+ before each blit to calculate shift+src address offset)

src+dst ptr (a0 and a4) are decremented by 4 after each blit, and incremented by C2C in the outer "y" loop.

there seem to be multiple cyclic framebuffers, I counted 8 so far.

the BPLCON0 scroll register is updated per frame (in sub 41b4c before the blits) (and in sync with the blit shifts)

I've spent ~2 hours with this but I have to admit that I have not yet fully understood how this effect really works :) maybe someone here can enlighten us to save some time :)

so basically what ryg said but maybe someone wants to continue with that info.
added on the 2010-11-24 22:46:12 by xyz xyz