English Amiga Board


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

 
 
Thread Tools
Old 22 October 2021, 10:52   #41
ross
Defendit numerus

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 51
Posts: 3,560
Quote:
Originally Posted by a/b View Post
Is this incremental, like you lower/raise the whole 16-pix column (or 2 halves, as you can use d=a+b) and then adjust individual columns or groups of columns up/down by 1 row from the previous frame, as needed?
I did a 3D bitmap rotation around y axis in a similar way. Basically, I precalculated delta blits needed to morph a frame into the next one, and then merged individual colums that needed shifting for the same amount horizontally, as long as they had the same height (3D perspective stretch/shrink), into groups that were then processed as a single blit. And then blitted in new colums that had a different height.
So a bunch of blit masks...
I write a little more during the day when I find a moment


Quote:
Originally Posted by Jobbo View Post
a/b

Where can I see that effect, it sounds awesome!!!

I always loved those rare rotation effects like in Brian the Lion that used an iterative vertical skew.

Actually, yours sounds like the rotating skull in Sanity Interference.
Yeahh, Brian the Lion rotation is great,
I always wanted to write something like this...

Quote:
Originally Posted by a/b View Post
Not to derail this thread... Coming (not so ) soon (TM) when I finally finish my trackmo. It looks ok, it's just a transitional effect. Yeah, you could compare it to the skull in Interference. But I'm using it as a "64x200 sliding window" on 320x200 picture while preparing something else in the background. And I'm also doing vertical scaling of parts of the picture in real-time because there wouldn't be enough room to prescale the whole picture. So while it's pretty optimized (50 fps and it only does ~8% of blits that a copy 1 by 1 approach would do) there's still enough room do to other stuff, it's not a main effect.
ross is offline  
Old 22 October 2021, 13:52   #42
ross
Defendit numerus

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 51
Posts: 3,560
I will probably say things that are too simplified for someone and verbose, so be patient, I try to make myself understood in the best possible way, but I am not very good in English..
The terms I use may not be the most appropriate so correct me in case.

We are all used to positional notation for writing numbers, since we only have a finite amount of 'symbols' available.
We have a 'digit', an 'index' and a 'radix', and any number can be written as (nx .. n2 n1 n0)b = (nx*b^x)+(n2*b^2)+(n1*b^1)+(n0*b^0).
In our mind immediately the position defines us the index, because we process the number as a whole.

But suppose we are in a system where the digit is 'shown' only in a deferred way, in practice you will know its value when you have already received the information for a previuos state (which define also an implicit index).
In practice a system in which the position is not indicated in a 'parallel' way, as when the number is displayed in full, but only sequentially.
Is the same principle as for serial communications: if you want to know a number between 0 and (b^x)-1 you have to go through x states,
in which each value has no meaning except through the knowledge (feedback) of the previous states.

Now let's go back to what is our purpose by making a simple example with a matrix of 16*16 points (bit), in which we self-impose a maximum displacement, with respect to an initial point, of 15 positions (therefore with 4 state we are able to indicate the displacement, including also the 'non-movement').
This give us a max slope of 45 degree in the bitmatrix: it's an arbitrary choice, I could use a lower or higher slope, just by changing the number of states.
If we take every single column and use it as a reference for the previous state then we can move it by b^x positions in each subsequent state (this is a key point!).
Yes, in every single state we do not know the final position but at the end of the deferred summation we have the final position because we have retroactively inherited the partial result.
We just need a system that allows us to decide when 'reuse' a value from a previous state (basically shifting it to the new state), so a selection mask between the 'do not change state' or 'change state to previous at b^(x-1)'.

This is defined with a logical operation: D=B*C+A*C' (minterm $D8).
Where C is the mask that decide if I grab b from the previous state at (B) or I maintain the current state at (A).
Then D become the new state (the future B..), (A and D need to point to same location and B to the old A/D location). oops! The blitter can do it
[A and D are updated changing the pointers to the new ^x position, so not linearly but exponentially, logb(y_offset)=x].
So for each state (so for each blitter operation on the column) I need a mask that decides whether or not I should use the feedback of the previous operation (hence my use of the term).
You can notice that if the mask is full 0 I can completely skip the operation! (because state is already defined and is not needed an update, is like inserting a 0 in a positional system; you can skip the operations where there 0*b^x).

Said in a simpler way and for a binary system: with 4 state I can arbitrarily move (shift) each column between 0 and 15 (2^4-1) positions.
Basically 4 times faster (minimum, because I can also skip some blitter operation if mask is 0) than doing it for every single column, not bad
How to calculate the mask(s)?
Well, as mentioned in a previous message, it can be seen as a C2P operation because in practice it's a bit rotation in a square matrix (you need to spread the state bit (that define the shift) 'vertically' to the mask bits, therefore existing algorithms can also be used.

Pheew, I don't even want to reread.., so I hope I wrote stuff sensibly and not too much bullsh*t.
For sure I forgot something, but in any case the key points are there.

Cheers!
ross is offline  
Old 22 October 2021, 14:16   #43
a/b
Registered User

 
Join Date: Jun 2016
Location: europe
Posts: 534
So in more practical terms... You first shift columns by 1 pixel, then by 2, then by 4, and finally by 8. If a column has to be shifted by 15 pixels, it's affected by all 4 shifts/blits and is contained in all 4 masks. If none of the columns needs to be shifted by more than say 3 pixels, you are done in 2 shifts (1+2).
a/b is offline  
Old 22 October 2021, 14:24   #44
ross
Defendit numerus

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 51
Posts: 3,560
Quote:
Originally Posted by a/b View Post
So in more practical terms... You first shift columns by 1 pixel, then by 2, then by 4, and finally by 8. If a column has to be shifted by 15 pixels, it's affected by all 4 shifts/blits and is contained in all 4 masks. If none of the columns needs to be shifted by more than say 3 pixels, you are done in 2 shifts (1+2).



Last edited by ross; 22 October 2021 at 14:43. Reason: bah, removed a sentence, I'm not sure of it :)
ross is offline  
Old 22 October 2021, 15:11   #45
a/b
Registered User

 
Join Date: Jun 2016
Location: europe
Posts: 534
Didn't think of that immediatelly, it's a really neat idea and quite logical. I was sure though it's some kind of incremental approach.
Now, I've been thinking a bit more about what I guessed earlier. Wouldn't that be even faster? If you are guaranteed a slope of 45 degress or less, then each column can only move 1 row up or down between consecutive frames. Meaning you can process the whole 16-pixel column in 1 or 2 blits, or... (!!) the entire screen in 2 blits if you use a dynamic mask as C (have two single row screen wide mask for each sine table entry, one for +1 and another for -1).
a/b is offline  
Old 22 October 2021, 15:25   #46
DanScott
Lemon. / Core Design

DanScott's Avatar
 
Join Date: Mar 2016
Location: Tier 5
Posts: 1,061
Quote:
Originally Posted by a/b View Post
Didn't think of that immediatelly, it's a really neat idea and quite logical. I was sure though it's some kind of incremental approach.
Now, I've been thinking a bit more about what I guessed earlier. Wouldn't that be even faster? If you are guaranteed a slope of 45 degress or less, then each column can only move 1 row up or down between consecutive frames. Meaning you can process the whole 16-pixel column in 1 or 2 blits, or... (!!) the entire screen in 2 blits if you use a dynamic mask as C (have two single row screen wide mask for each sine table entry, one for +1 and another for -1).
Depends how "fast" you are moving the sine wave through the image... if you move it slowly, then yes, you can guarantee only 1 pixel movement each way with a 45 degree max slope...but... it's going to look quite slow and unpleasing

Also if you are going to actually "scroll" the image right to left (rather than just sine a static image) then this also will increase max y deltas... and of course complicate how you actuall do the scroll (and bring in new data at the correct place on the right)
DanScott is offline  
Old 22 October 2021, 16:03   #47
ross
Defendit numerus

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 51
Posts: 3,560
Quote:
Originally Posted by a/b View Post
Didn't think of that immediatelly, it's a really neat idea and quite logical. I was sure though it's some kind of incremental approach.
Now, I've been thinking a bit more about what I guessed earlier. Wouldn't that be even faster? If you are guaranteed a slope of 45 degress or less, then each column can only move 1 row up or down between consecutive frames. Meaning you can process the whole 16-pixel column in 1 or 2 blits, or... (!!) the entire screen in 2 blits if you use a dynamic mask as C (have two single row screen wide mask for each sine table entry, one for +1 and another for -1).
Well, this can work for some specific effect, but as Dan said for *very* limited sine speeds

Quote:
Originally Posted by DanScott View Post
Also if you are going to actually "scroll" the image right to left (rather than just sine a static image) then this also will increase max y deltas... and of course complicate how you actuall do the scroll (and bring in new data at the correct place on the right)
Of course this method works and is born for scrolling images, I have a version somewhere that does it even using a playfield made entirely of sprites
I went a bit crazy to calculate the positions so that the curve could be displayed without having more than 8 present on the screen on the same line but that covered all the x.
ross is offline  
Old 22 October 2021, 16:09   #48
Jobbo
Registered User

Jobbo's Avatar
 
Join Date: Jun 2020
Location: Druidia
Posts: 233
Ross, thanks for sharing. Do you have any released demos from the past that I can watch? You always have some good insight on lots of topics, but I don't know of your work.
Jobbo is offline  
Old 22 October 2021, 16:29   #49
ross
Defendit numerus

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 51
Posts: 3,560
Quote:
Originally Posted by Jobbo View Post
Ross, thanks for sharing. Do you have any released demos from the past that I can watch? You always have some good insight on lots of topics, but I don't know of your work.
Nah, nothing good from me
I like keep a low profile on the scene for personal reasons.
So I only do it as a mental exercise and to have some fun.
ross is offline  
Old 22 October 2021, 21:58   #50
morbid
Registered User

 
Join Date: Aug 2020
Location: Huddinge
Posts: 22
Quote:
Originally Posted by a/b View Post
So in more practical terms... You first shift columns by 1 pixel, then by 2, then by 4, and finally by 8. If a column has to be shifted by 15 pixels, it's affected by all 4 shifts/blits and is contained in all 4 masks. If none of the columns needs to be shifted by more than say 3 pixels, you are done in 2 shifts (1+2).
This is very similar to my sinescroll in the demo 'alt cure'.
I first copy one word from the source bitmap to the highest point on the curve within that word.
I then slide pixel columns down with a mask based on their delta y for 1, 2, 4, 8 and 16 pixels.
I of course only do the sliding if it is needed, and all masks and deltas are precalculated just before the effect starts.
morbid is offline  
Old 23 October 2021, 10:36   #51
Int42
Registered User

 
Join Date: Oct 2021
Location: Berlin/Germany
Posts: 12
Very interesting tech talk here. I don't understand all of that, some things are to advanced for me, but I'll try to learn it.
Difficult to learn for me are things like calculating or rotating stuff with the blitter, or do thinks like zoom with it. I only used the blitter to copy blocks, draw lines and fill areas, but I'm miles away from understanding those delta calculation things or this 1, 2, 4, 8 slide description above, can anybody draw a little sketch, with paint or so, to visual that please?

I'm very impressed about this forum, sorry for my really bad english, I'm an old german native speaker and in my english lessons at school I dreamed to much about the Amiga^^
Int42 is offline  
Old 23 October 2021, 19:54   #52
Antiriad_UK
OCS forever!

Antiriad_UK's Avatar
 
Join Date: Mar 2019
Location: Birmingham, UK
Posts: 414
@Morbid *penny drops* ahhh I get it now
Antiriad_UK is offline  
Old 23 October 2021, 22:20   #53
DanScott
Lemon. / Core Design

DanScott's Avatar
 
Join Date: Mar 2016
Location: Tier 5
Posts: 1,061
Quote:
Originally Posted by Antiriad_UK View Post
@Morbid *penny drops* ahhh I get it now
yep.. took me until post #42 before I finally got it 100%...

I think there's other things that can "benefit" from this technique too
DanScott is offline  
Old 23 October 2021, 22:58   #54
ross
Defendit numerus

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 51
Posts: 3,560
Ok, then it's time to cancel that disgraceful gifanim at message #28
ross is offline  
Old 24 October 2021, 00:06   #55
Antiriad_UK
OCS forever!

Antiriad_UK's Avatar
 
Join Date: Mar 2019
Location: Birmingham, UK
Posts: 414
Quote:
Originally Posted by DanScott View Post
yep.. took me until post #42 before I finally got it 100%...

I think there's other things that can "benefit" from this technique too
#42 was still gibberish to me!
Antiriad_UK is offline  
Old 24 October 2021, 00:07   #56
Antiriad_UK
OCS forever!

Antiriad_UK's Avatar
 
Join Date: Mar 2019
Location: Birmingham, UK
Posts: 414
Quote:
Originally Posted by ross View Post
Ok, then it's time to cancel that disgraceful gifanim at message #28
No, leave it It's helpful.
Antiriad_UK is offline  
Old 24 October 2021, 01:03   #57
ross
Defendit numerus

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 51
Posts: 3,560
Quote:
Originally Posted by Antiriad_UK View Post
No, leave it It's helpful.
I can re-post this:

[REMOVED]

Dan was sick for 2 days when he saw it


Even that removed, looking at it gives me a headache

Last edited by ross; 24 October 2021 at 01:16.
ross is offline  
Old 24 October 2021, 01:18   #58
DanScott
Lemon. / Core Design

DanScott's Avatar
 
Join Date: Mar 2016
Location: Tier 5
Posts: 1,061
I'm just always sick :P
DanScott is offline  
Old 24 October 2021, 01:26   #59
ross
Defendit numerus

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 51
Posts: 3,560
Quote:
Originally Posted by DanScott View Post
yep.. took me until post #42 before I finally got it 100%...
Quote:
Originally Posted by Antiriad_UK View Post
#42 was still gibberish to me!
ROTFL
https://en.wikipedia.org/wiki/Phrase...erything_is_42

And the thread is by Int42.
it cannot be accidental
ross is offline  
Old 26 October 2021, 08:33   #60
morbid
Registered User

 
Join Date: Aug 2020
Location: Huddinge
Posts: 22
Quote:
Originally Posted by Antiriad_UK View Post
@Morbid *penny drops* ahhh I get it now
I took me years to figure it out...

Quote:
Originally Posted by DanScott View Post
I think there's other things that can "benefit" from this technique too
Now, this sounds interesting! Do you have any suggestions?
morbid 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
Alien Breed II title pixel by pixel logo removal dex project.Sprites 17 06 May 2020 16:23
Sine scroller pmc Coders. Tutorials 95 02 July 2017 17:40
Sinus Creator/Editor Legionary Nostalgia & memories 2 11 February 2017 18:49
Working / Creating Sinus tables h0ffman Coders. Tutorials 6 16 January 2011 00:37
Corkscrew scroller pmc Coders. Tutorials 33 01 September 2010 13:41

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 11:06.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.
Page generated in 0.13377 seconds with 15 queries