22 October 2021, 09:52 | #41 | |||
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,536
|
Quote:
Quote:
I always wanted to write something like this... Quote:
|
|||
22 October 2021, 12:52 | #42 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,536
|
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! |
22 October 2021, 13:16 | #43 |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,097
|
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).
|
22 October 2021, 13:24 | #44 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,536
|
Quote:
Last edited by ross; 22 October 2021 at 13:43. Reason: bah, removed a sentence, I'm not sure of it :) |
|
22 October 2021, 14:11 | #45 |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,097
|
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). |
22 October 2021, 14:25 | #46 | |
Lemon. / Core Design
Join Date: Mar 2016
Location: Tier 5
Posts: 1,220
|
Quote:
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) |
|
22 October 2021, 15:03 | #47 | ||
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,536
|
Quote:
Quote:
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. |
||
22 October 2021, 15:09 | #48 |
Registered User
Join Date: Jun 2020
Location: Druidia
Posts: 391
|
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.
|
22 October 2021, 15:29 | #49 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,536
|
Quote:
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. |
|
22 October 2021, 20:58 | #50 | |
Registered User
Join Date: Aug 2020
Location: Huddinge
Posts: 26
|
Quote:
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. |
|
23 October 2021, 09:36 | #51 |
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^^ |
23 October 2021, 18:54 | #52 |
OCS forever!
Join Date: Mar 2019
Location: Birmingham, UK
Posts: 418
|
@Morbid *penny drops* ahhh I get it now
|
23 October 2021, 21:20 | #53 |
Lemon. / Core Design
Join Date: Mar 2016
Location: Tier 5
Posts: 1,220
|
|
23 October 2021, 21:58 | #54 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,536
|
Ok, then it's time to cancel that disgraceful gifanim at message #28
|
23 October 2021, 23:06 | #55 |
OCS forever!
Join Date: Mar 2019
Location: Birmingham, UK
Posts: 418
|
|
23 October 2021, 23:07 | #56 |
OCS forever!
Join Date: Mar 2019
Location: Birmingham, UK
Posts: 418
|
|
24 October 2021, 00:03 | #57 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,536
|
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 00:16. |
24 October 2021, 00:18 | #58 |
Lemon. / Core Design
Join Date: Mar 2016
Location: Tier 5
Posts: 1,220
|
I'm just always sick :P
|
24 October 2021, 00:26 | #59 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,536
|
ROTFL
https://en.wikipedia.org/wiki/Phrase...erything_is_42 And the thread is by Int42. it cannot be accidental |
26 October 2021, 07:33 | #60 |
Registered User
Join Date: Aug 2020
Location: Huddinge
Posts: 26
|
|
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 15:23 |
Sine scroller | pmc | Coders. Tutorials | 95 | 02 July 2017 16:40 |
Sinus Creator/Editor | Legionary | Nostalgia & memories | 2 | 11 February 2017 17:49 |
Working / Creating Sinus tables | h0ffman | Coders. Tutorials | 6 | 15 January 2011 23:37 |
Corkscrew scroller | pmc | Coders. Tutorials | 33 | 01 September 2010 12:41 |
|
|