English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 17 June 2016, 21:11   #21
DanScott
Lemon. / Core Design
 
DanScott's Avatar
 
Join Date: Mar 2016
Location: Tier 5
Posts: 1,212
Roots 2.0 rotozoomer is AGA only.

It uses a 4 bitplane "grid" of lines for the x texels overlaid with a 4 bitplane "grid" for the y texels giving a 16x16 image with each texel being one of 256 palette entries.

The technique is explained in some forums on t'internet somewhere.. I read them a while back
DanScott is offline  
Old 17 June 2016, 22:02   #22
zero
Registered User
 
Join Date: Jun 2016
Location: UK
Posts: 428
Okay, got around to testing with lines instead of a checkboard:



Next step, try with pre-rendered bitmaps.
zero is offline  
Old 17 June 2016, 22:31   #23
zero
Registered User
 
Join Date: Jun 2016
Location: UK
Posts: 428
Hmm...



I need to think about the mathematics of this a little more.
zero is offline  
Old 17 June 2016, 23:00   #24
Mrs Beanbag
Glastonbridge Software
 
Mrs Beanbag's Avatar
 
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
what's going on there?
Mrs Beanbag is offline  
Old 17 June 2016, 23:29   #25
zero
Registered User
 
Join Date: Jun 2016
Location: UK
Posts: 428
I'm copying lines from the right to create the image on the left. It's not working properly.
zero is offline  
Old 18 June 2016, 04:28   #26
ReadOnlyCat
Code Kitten
 
Join Date: Aug 2015
Location: Montreal/Canadia
Age: 52
Posts: 1,178
Quote:
Originally Posted by DanScott View Post
Roots 2.0 rotozoomer is AGA only.

It uses a 4 bitplane "grid" of lines for the x texels overlaid with a 4 bitplane "grid" for the y texels giving a 16x16 image with each texel being one of 256 palette entries.

The technique is explained in some forums on t'internet somewhere.. I read them a while back
My, that is certainly clever.
So essentially the color values in these two "playfields" are used as X & Y indices into the texture bitmap and the CLUT of the Amiga is used as a bidimensionnal array with each playfield indexing one of the dimensions.

Which reduces obviously the effect to very small 16x16 textures but is very likely super light in CPU since one only needs to modify a few copper registers per line to obtain the effect. (If all the precomputed patterns can fit in memory, otherwise one would have to compute the ones which are not currently present.)

Good job.

Quote:
Originally Posted by zero View Post
I'm copying lines from the right to create the image on the left. It's not working properly.
This is because you use the fully combined results on the right image.
You should use the right image obtained strictly from the stripes.

Image right:
line1 = mid line with rotation 0 (degrees)
line2 = mid line with rotation n
line3 = mid line with rotation 2n
...
line 100 = mid line with rotation 90 (degrees)

Then to create the rotated image of a checkerboard:

color 0 = black,
color 1 = white
color 2 = white
color 3 = black

for rotation R (in 1/100th of 90 degrees):
line1-bitplane1= line R of image-right shifted-and-replicated R-in-radians * screen-height-div-2 pixels to the left
line1-bitplane2= line (R+100)%100 of image right shifted-and-replicated R-in-radians * screen-height-div-2 pixels to the left
line2-bitplane1= line R of image-right shifted-and-replicated R-in-radians * (screen-height-div-2 - 1) pixels to the left
line2-bitplane2= line (R+100)%100 of image right shifted-and-replicated R-in-radians * (screen-height-div-2 -2) pixels to the left
line3-bitplane1= line R of image-right shifted-and-replicated R-in-radians * (screen-height-div-2 - 2) pixels to the left
line3-bitplane2= line (R+100)%100 of image right shifted-and-replicated R-in-radians * (screen-height-div-2 -2) pixels to the left

... If I didn't mess anything.

Note that this is strictly Mrs Beanbag's solution, I did not invent anything here.

Last edited by ReadOnlyCat; 18 June 2016 at 04:33. Reason: Fixed the formulas.
ReadOnlyCat is offline  
Old 18 June 2016, 16:23   #27
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
I never figured out how this one worked either.

The simpler version of it that only rotates in the screen plane is easier to understand, with the key observation being that two perpendicular gradients will form a regular grid when overlaid.

It's easy to see if you run f.ex. Comadose/Passion in WinUAE and only view 4 bitplanes at a time:
[ Show youtube player ]

This type of effect uses the same concept, but with a static pattern:
[ Show youtube player ]

Not sure if you can achieve the perspective effect by just drawing a different sized grid on each scanline, there's probably something more to it.

Last edited by Leffmann; 18 June 2016 at 16:31.
Leffmann is offline  
Old 18 June 2016, 17:29   #28
zero
Registered User
 
Join Date: Jun 2016
Location: UK
Posts: 428
Thanks guys. This was my assumption all along, that the texture was just a 16x16 colour mapping (256 colours). I'm just trying to get 1 bitplane working first.

ReadOnlyCat: I really don't follow what you are saying here. When you talk about the colours, what are you referring to? There are only two colours, it's a single bitplane.

Leffmann, I love that demo, it's one of my favourites! The effect you link is indeed a variation of this it seems, perhaps worth studying to get some hints. I'll try to rip their pre-rendered bitmaps for examination. That was a good find, I must have seen it hundreds of times but didn't think to look at it in detail.

Also, I think my pre-rendered bitmaps are not right, I manually tried to locate every line in the resulting image and they are not all there.
zero is offline  
Old 18 June 2016, 19:51   #29
Mrs Beanbag
Glastonbridge Software
 
Mrs Beanbag's Avatar
 
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
zero: you have to use two bitplanes to recreate this effect with a checkerboard, since the pattern is essentially a 2x2 texture

Quote:
Originally Posted by Leffmann View Post
Not sure if you can achieve the perspective effect by just drawing a different sized grid on each scanline, there's probably something more to it.
I too, would like to know how this was done, it would be an awesome effect to use in a game

Last edited by Mrs Beanbag; 18 June 2016 at 21:32.
Mrs Beanbag is offline  
Old 19 June 2016, 23:01   #30
Kalms
Registered User
 
Join Date: Nov 2006
Location: Stockholm, Sweden
Posts: 237
For perspective: do perspective projection calculations for each scanline, then pick the appropriate predefined bitmap-line like you do in your current implementation.
You may need a wider range of prerendered bitmap-lines to be able to 'zoom out' the pattern in far-away sections of the screen.
Kalms is offline  
Old 20 June 2016, 07:30   #31
ReadOnlyCat
Code Kitten
 
Join Date: Aug 2015
Location: Montreal/Canadia
Age: 52
Posts: 1,178
Quote:
Originally Posted by Kalms View Post
For perspective: do perspective projection calculations for each scanline, then pick the appropriate predefined bitmap-line like you do in your current implementation.
You may need a wider range of prerendered bitmap-lines to be able to 'zoom out' the pattern in far-away sections of the screen.
Far away sections might not require that many bitmaps since one can count on aliasing to essentially make these bitmaps essentially a series of blurred average colors.

Once a pixel covers more than the full 16x16 bitmap one can keep reusing the same patterns since everything will heavily suffer from moire effects anyway.
ReadOnlyCat is offline  
Old 20 June 2016, 19:42   #32
Mrs Beanbag
Glastonbridge Software
 
Mrs Beanbag's Avatar
 
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
Quote:
Originally Posted by Kalms View Post
For perspective: do perspective projection calculations for each scanline, then pick the appropriate predefined bitmap-line like you do in your current implementation.
You may need a wider range of prerendered bitmap-lines to be able to 'zoom out' the pattern in far-away sections of the screen.
that's easy enough for perspective in a strictly horizontal plane, but if you watch the above-mentioned demo, it rotates in all directions.
Mrs Beanbag is offline  
Old 20 June 2016, 20:00   #33
zero
Registered User
 
Join Date: Jun 2016
Location: UK
Posts: 428
Quote:
Originally Posted by Mrs Beanbag View Post
that's easy enough for perspective in a strictly horizontal plane, but if you watch the above-mentioned demo, it rotates in all directions.
It doesn't, it rotates on the Y and X axis, but not on Z. In other words, the camera can rotate side to side and up/down, but it can't roll.
zero is offline  
Old 20 June 2016, 20:34   #34
Mrs Beanbag
Glastonbridge Software
 
Mrs Beanbag's Avatar
 
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
Quote:
Originally Posted by zero View Post
It doesn't, it rotates on the Y and X axis, but not on Z. In other words, the camera can rotate side to side and up/down, but it can't roll.
you are right, it seems my memory is playing tricks on me. and i only watched the video the other day.
Mrs Beanbag is offline  
Old 26 June 2016, 22:49   #35
zero
Registered User
 
Join Date: Jun 2016
Location: UK
Posts: 428
Not had much time to work on this lately, but found something interesting:

http://ada.untergrund.net/?p=demo&i=609

"The rotator is essentially the isame dea as Chaos used for the 1x1 pixel rotator in Roots, but instead of precalcing gfx, which makes perspective possible, you just draw 1 (wide) line realtime and stretch the odd/even planes across the screen to achieve the checkerboard."


"It's simply based on the observation that you can rotate a vertical bar by stretching it horizontally while skewing it. You only need to draw 1 scanline (I used BFSET and filled it with blitter) and then stretch it with modulo and skew it with $102. It gets a little dodgy around 90 degree rotation, and IIRC I used some special case to handle that properly."


Screenshots

User Comments (10)
comment by z5 on 19 August 2007
The results of The Party 1995 intro competition still puzzle me. Only 15th position for this intro, the great Indifference from Abyss only 13th... I definately need to check the intros from position 4 to 10 as i haven't seen none of them yet...

Anyway, nice 40k intro. Great tune from Subject. Though it shows that no graphician was involved, imo. There is no consistency in look running through the different scenes (not that there always should be).

I'll add a download link soon.
comment by Frequent on 26 August 2007
Runs oddly on my PPC/060 Amy, so I guess the codework is not the best when it comes to compability issues. On the other hand, the effects looks nice if you have a slow accelerator like 030-50. Very nice tune by subject/prophet. A piggy from me.
comment by z5 on 20 September 2007
@boogeyman: i noticed that you visit this site sometimes. It would be great to find out what you've been up to after you quit coding on the Amiga and if you are still following the demoscene nowadays,... )
comment by corial on 20 September 2007
I've always liked this little intro. Fine rotator, which I believe only Dr. Skull has made, besides Boogeyman. I've always been impressed with the framerate of Boogeyman's effects - later productions really showed that he knew his bits'n'bytes well!
comment by Boogeyman on 21 September 2007
z5, I just recently found my old amiga hardrive backed up on a cd in the closet, and felt encouraged to try out winuae, which didn't really like this particular intro very much (bugs alot), but maybe I'm just not setting it up right.

The nostalgia trip furthermore made me wanna check out this page, and I've been stopping by every now and then since.

I haven't coded a line of Amiga assembler since finishing Alien 2, but I've been working for a IT company which develops applications for banks during the past 10 years. Bionic/Silents works here too!


corial, I'm glad you like it. The rotator is essentially the isame dea as Chaos used for the 1x1 pixel rotator in Roots, but instead of precalcing gfx, which makes perspective possible, you just draw 1 (wide) line realtime and stretch the odd/even planes across the screen to achieve the checkerboard.
comment by z5 on 21 September 2007
@boogeyman: thanks! you did some great stuff back then so i'm really glad and honoured that you're dropping by from time to time. Great to know that Bionic is working with you too. It's a small world sometimes )

Hopefully you will want to check out some of the stuff that came after you left the scene aswell someday.

And indeed, comadose doesn't like winuae. Yet, i managed to take all these screenshots with Winuae.
comment by Toffeeman on 11 April 2008
@Boogeyman I've just come across this intro now for the first time as it appeard as a feature on the ADA home page. I'm gonna check it out now though ! Any chance you could say step by step how that rotator works for a simple mind like mine ?

Did you invent this idea yourself or did you find out how Chaos did it and modified the idea ?
comment by Boogeyman on 11 April 2008
Toffeeman, I didn't invent the idea myself, I saw the rotators Chaos and Skull did, and wondered how the hell it was possible. Then I found the copperlist in memory, and the method became obvious.

It's simply based on the observation that you can rotate a vertical bar by stretching it horizontally while skewing it. You only need to draw 1 scanline (I used BFSET and filled it with blitter) and then stretch it with modulo and skew it with $102. It gets a little dodgy around 90 degree rotation, and IIRC I used some special case to handle that properly.
comment by Boogeyman on 11 April 2008
We need a edit button

"Needed to clarify that the modulo of course stretched the scanline vertically - the horizontal stretch is achieved by zooming the coordinates used to draw the bars in the 1 scanline."

This makes a lot more sense now.
zero is offline  
Old 29 June 2016, 23:12   #36
zero
Registered User
 
Join Date: Jun 2016
Location: UK
Posts: 428
Okay. I have rotating vertical lines now based on the technique described by Boogeyman. Just need to tidy it up a bit and then work on some bitplane emulation.
zero is offline  
Old 05 July 2016, 14:21   #37
crabman
Registered User
 
Join Date: Mar 2014
Location: basement
Posts: 26
When rotating, actually nutating, in "3d" how do you set up the perspective for each line to be purely incremental, can't be doing a mul or lookup for every pixel.
crabman is offline  
Old 05 July 2016, 14:39   #38
zero
Registered User
 
Join Date: Jun 2016
Location: UK
Posts: 428
You only need to calculate dx/dy coordinates for one pixel per line, so only 256 per frame. Remember that rotation is only on two axis, so every scanline is always one horizontal stripe of pixels in your pre-generated bitmap.
zero is offline  
Old 05 July 2016, 19:27   #39
crabman
Registered User
 
Join Date: Mar 2014
Location: basement
Posts: 26
Ok, but won't that at least technically be incorrect projection, affine instead of perspective? Probably good enough though.
crabman is offline  
Old 05 July 2016, 22:36   #40
Mrs Beanbag
Glastonbridge Software
 
Mrs Beanbag's Avatar
 
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
no, each scanline is at constant Z-depth, so it is easy
Mrs Beanbag is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sanity - World of Commodore (preview) WHDLoad Hewitson support.Demos 7 08 June 2010 04:36
Sanity Copy musashi9 request.Apps 2 31 July 2008 16:54
Sanity - Arte Paul_s request.Demos 4 13 October 2007 21:21
Sanity Operating System cpeel2300 Coders. General 0 01 April 2005 00:00
Song from Jester / Sanity SliPStREAM request.Modules 1 06 February 2002 23:19

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 07:43.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.09863 seconds with 14 queries