Jump to content

Photo

Vertical bars demo


7 replies to this topic

#1 Asmusr OFFLINE  

Asmusr

    River Patroller

  • 2,143 posts
  • Location:Denmark

Posted Mon Feb 20, 2017 3:29 PM

The vertical bars is a classic demo effect. Here's an example of how it could look on the Amiga:

 

Attached File  320px-Vertical_Raster_Bars.png   27.96KB   3 downloads

 

The traditional way of drawing the effect requires a palette based screen mode where the palette has as many entries as the horizontal resolution of the image. The screen is set up in advance by drawing vertical, pixel thin lines from the top to the bottom of the screen. The leftmost line in drawn using palette entry 0, the one next to it using palette entry 1, and so on until the rightmost line is drawn using the last entry of the palette. 

 

To draw a frame you start at vertical refresh by resetting all colors in a palette to the background color. Before the first scanline is drawn you 'light up' some of the palette entries next to each other to draw a horizontal slice of a bar. Because of the vertical lines in the image, the bar slice will be repeated at each subsequent scanline of the image. At the next scanline you move the position, i.e. the start palette index, a little (often following a sine wave) and draw another bar slice, and so on until you either decide to stop or reach the bottom of the screen. Note that because you change the palette as the screen is drawn, changes made at a given vertical position on the screen will not affect scanlines above it.

 

With the recent 'discovery' of scanline effects on the TI, is it possible to implement this effect? We don't have a real palette based mode, and yet we do have the color sets of graphics mode 1. There are 32 color sets available, and each has both a background and a foreground color available, giving us a resolution of 64 palette entries. This is still only one entry per 4 horizontal pixels (4 x 64 = 256), but it's better than nothing.  

 

To prepare the screen we redefine the first character in each color set (0, 8, 16, ..., 248) to a pattern that has half foreground and half background color. We then draw vertical 'lines' on the screen using each of the 32 characters, like this:

 

Attached File  vertbars1.png   875bytes   2 downloads

 

By changing the 32 bytes of the color table we can now change the color of each vertical line individually.

 

Now we're ready to go. We wait for vertical refresh and set the entire color table to black. We draw a bar slice by setting a few entries in the color table to other colors than black. To detect which scanline we have reached we place 5 invisible sprites on the desired scanline and poll the 5th sprite flag until it is set. To quickly set up the sprites, we can prepare the sprite attribute tables in VDP RAM in advance so we only have to set one register. To move the bar slices we have a sine table prepared in advanced. 

 

If everything runs from scratchpad we have time to draw 2 bars slices of 6 colors (or 3 bytes) every 4 scanlines. The result looks like this:

 

Attached File  screenshot2.png   4.67KB   2 downloads

 

It's a bit flickering and not very pretty, but now there's one less thing the TI-99/4A can't do.  :)

 

Could it be done using multicolor mode instead, without any scanline tricks? Possible, but I think it would be pretty slow.

 

The music is "Let's kill the rainforest" by Rushjet. I hope it's OK I have used it for this demo. It fits well with the intense display.

 

Attached Files



#2 Lee Stewart OFFLINE  

Lee Stewart

    River Patroller

  • 3,053 posts
  • Location:Silver Run, Maryland

Posted Mon Feb 20, 2017 3:46 PM

Very nice, indeed, Rasmus.

 

...lee



#3 ti99iuc OFFLINE  

ti99iuc

    Stargunner

  • 1,098 posts
  • Location:Italy

Posted Mon Feb 20, 2017 3:47 PM

:thumbsup:   cool !!



#4 fabrice montupet OFFLINE  

fabrice montupet

    Chopper Commander

  • 175 posts
  • Location:Burgundy - France

Posted Tue Feb 21, 2017 5:59 PM

Hypnotic and excellent! 



#5 arcadeshopper OFFLINE  

arcadeshopper

    River Patroller

  • 2,059 posts
  • Location:Portland, Oregon USA

Posted Tue Feb 21, 2017 6:31 PM

wowza   very nifty



#6 TheBF OFFLINE  

TheBF

    Star Raider

  • 65 posts

Posted Thu Mar 23, 2017 10:22 PM

How do I run VERTBARS.DSK on Classic99?

 

 

BF

 

Edit Never mind. ... Read the menus.  DUH


Edited by TheBF, Thu Mar 23, 2017 10:41 PM.


#7 gregallenwarner OFFLINE  

gregallenwarner

    Chopper Commander

  • 181 posts

Posted Today, 11:15 AM

Can you explain this recent "discovery" of scanline effects in more detail? What was discovered about the TI that lets you do this? I was under the impression that the video hardware did not issue scanline interrupts, only field interrupts 50/60 times a second.



#8 Asmusr OFFLINE  

Asmusr

    River Patroller

  • Topic Starter
  • 2,143 posts
  • Location:Denmark

Posted Today, 12:03 PM

Can you explain this recent "discovery" of scanline effects in more detail? What was discovered about the TI that lets you do this? I was under the impression that the video hardware did not issue scanline interrupts, only field interrupts 50/60 times a second.

 

The recent "discovery" was that you can determine the vertical position of the "bean" within a reasonable precision (one scanline or so) using the 5th sprite flag. You simply place 5 sprites on the screen at the position where you want to do something, and then start polling the VDP status for the flag. When you have done something, you move the sprites further down the screen to the next position where you want to do something, and start polling again. You could also use the collision flag for the same effect, but I found it to be less reliable on real hardware.






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users