[comp.sys.amiga] Swapping graphics pages at 60Hz

drascic@ecf.UUCP (07/03/87)

SUMMARY: (question from a novice)
    Does the Amiga have the capability of creating separate graphics
    pages which can be swapped at a rate of 60 Hz, in sync with the
    video display?

I am considering purchasing an Amiga in order to overlay computer
graphics on a video image.  But I'm not working with just ordinary
video and graphics: I'm working in 3D stereoscopic video.

The method I'm using involves alternating views.  I have liquid
crystal shutters that block of the view of first the right, and then
the left, eye.  By presenting left and right eye views on the screen
at a fast enough rate, the illusion of depth is given.

The standard 30 Hz interlaced NTSC video signal presents 30 frames per
second. But if the frames were drawn in the obvious way, all the lines
from top to bottom, 30 times per second, the resultant image would
flicker in an annoying way.  Instead, each frame is split into EVEN
lines (2,4,6,etc.) and ODD lines, thus creating two slightly
different pictures with half the resolution.  All of the even lines
are drawn first, from top to bottom, followed by all of the odd
lines.  This results in a 60 Hz flicker, which is much less noticeable.

In order to generate our stereo display, we use the EVEN lines for the
left view, and the ODD lines for the light view.  These two views
come from different cameras.  What we want to do is use the Amiga to
draw dynamic three dimensional, "stereo" images in the same way.  We will
thus need two graphics buffers, and we will need to be able to switch
between these 60 times a second, in sync with the screen refresh.  Is
this possible?  Is it amazingly difficult?  I know the Atari can
do it, since they are marketing similar glasses with software.  But
we need to overlay the graphics on a video signal, and thus can
use the Amiga's genlock board.  This makes the Amiga more suitable for
our needs, provided that it can do stereoscopic animation.

Since we want to do simple animation, it seems to me that we will need
4 graphics buffers:  two for the current left and right views, and
two in which to draw the new left and right views.  This will prevent
the drawing of the new image from being seen.  If we were only drawing
a simple, 3D wireframe cube, would this be necessary?  If so, can it
be done?

Thanks.

	David Drascic.
	  drascic@utecfb    OR    drascic@ecf.toronto.edu

wtm@neoucom.UUCP (Bill Mayhew) (07/06/87)

I can't give the the absolute complete nitty gritty details, but I
did help one of our faculty member's son get going on a science
fair project on his Amiga.

He programmed the project in AmigaBasic (the Mircosoft, not
Metacomco interpreter).  He used the ScreeToFront() and
ScreenToBack() functions after opening two screens in Basic.  He
used the digital output lines of the printer port to darken and
clear two LCD sheets installed in the frames from a cheap pair of
sun glasses.  WaitTOF() can be used to wait for the retrace
interval so that the glasses can be switched at an unobtrusive
time.

The Addison-Wessley Rom Kernel Manual provides the necessay info on
the routines.  Note we used the printer port to control the
glasses, as we had difficulty setting the second mouse prot for
digital output.  Something kept switching it back to input mode.

Carolyn Schepner of CATS posted several nice examples of
manipulating screens in Basic a while back.  One thing that is
helpful is to find somebody that has the "FD" files from the C
compiler to feed into "ConvertFD" on the AmigaBasic disk to produce
the necessary ".BMAP" files that enalbe Basic's LIBRARY statement
to find the routines mentioned above.  The Amigabasic disk also
contians several example programs, LoadILBM, or some such name that
are useful examples.

Rather than swapping screens, you could also play with the color
table to avoid the complexity of dealing with screens.  That sould
be OK for your application, since you are only interested in wire
frame objects.

Hope this helps,
Bill (wtm@noeucom.UUCP)

ewhac@well.UUCP (Leo 'Bols Ewhac' Schwab) (07/06/87)

In article <187@mv05.ecf.toronto.edu> drascic@ecf.UUCP writes:
>SUMMARY: (question from a novice)
>    Does the Amiga have the capability of creating separate graphics
>    pages which can be swapped at a rate of 60 Hz, in sync with the
>    video display?
>
	Yes, it does.  Next topic.

	Oh, all right, I'll elaborate.  Mind you, I can't elaborate much,
since I'm non-disclosured up to yin-yang on this.

	Suffice it to say that I personally have been working on this very
thing for about the last two months solid, and the company I'm working for
has been doing this for at least the past six months, if not *much* longer.

	I've cooked up at least half a dozen stereo pairs, both with DPaint
II and DigiView, as well as driver/viewing software.  We've successfully
gotten the StereoTek LCD glasses driver (which is marked, "For use with
Atari ST ONLY") to work on the Amiga.  I've also done a few other 3D goodies
as well.

	Unfortunately, I can't release specific implementation details,
since they're *very* proprietary.  However, my boss and I have hatched a
scheme that may put this technology in your hands:

NO_PROMISES	NO_PROMISES	NO_PROMISES	NO_PROMISES	NO_PROMISES

	We're thinking of marketing a "3D Experimenter's Kit:"  A collection
of hardware and software tools and techniques to create your own 3D stuff.
This package would contain glasses (with driver), software glasses driver,
IFF stereo pairs to gawk at, 3D display hacks, and software subroutines
(with source) so you can understand and use 3D on your own.  We'd also give
you a manual describing the "rules" for using 3D, how to make pairs in
DPaint, etc.

	The problem we're having with this idea is that we're not sure just
how successful it would be (there is no CAD-3D equivalent for the Amiga),
nor how much we should charge for it.  Would you buy such a beast?  How much
would you pay for it?  $100?  $150?  $200?  $6999.95?  Let me know; I'll
save all responses, wrap them in a nice package, and give them to my boss.

>What we want to do is use the Amiga to
>draw dynamic three dimensional, "stereo" images in the same way.  We will
>thus need two graphics buffers, and we will need to be able to switch
>between these 60 times a second, in sync with the screen refresh.  Is
>this possible?
	Yes.
>Is it amazingly difficult?
	No.

	I like succinct responses, don't you? :-)

>I know the Atari can
>do it, since they are marketing similar glasses with software.

	They sorta cheat.  Plus you can't genlock Atari stuff (easily).  All
our stuff works with existing 3D video, and genlocks.  So there.

>	David Drascic.
>	  drascic@utecfb    OR    drascic@ecf.toronto.edu

	I will feed your name to my boss to be added to the list of people
to file court-imposed restraining orders against :-) :-) :-) :-) :-) :-).

_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
Leo L. Schwab -- The Guy in The Cape	ihnp4!ptsfa -\
 \_ -_	 Bike shrunk by popular demand,	      dual ---> !{well,unicom}!ewhac
O----^o	 But it's still the only way to fly.  hplabs / (pronounced "AE-wack")
"Work FOR?  I don't work FOR anybody!  I'm just having fun."  -- The Doctor

scotty@l5comp.UUCP (Scott Turner) (07/10/87)

In article <3504@well.UUCP> ewhac@well.UUCP (Leo 'Bols Ewhac' Schwab) writes:
>In article <187@mv05.ecf.toronto.edu> drascic@ecf.UUCP writes:
>>What we want to do is use the Amiga to
>>draw dynamic three dimensional, "stereo" images in the same way.  We will
>>thus need two graphics buffers, and we will need to be able to switch
>>between these 60 times a second, in sync with the screen refresh.  Is
>>this possible?
>	Yes.
>>Is it amazingly difficult?
>	No.
>
>	I like succinct responses, don't you? :-)
Well, I've been watching North all day on CNN and he doesn't seem to like them
so...

First off, the Amiga has some of the most unique video display hardware
available in a PC. It's so unique I bought one even though it came with a
Commodore label on it. (How about THAT for an advertizing campaign? "Yeah,
this computer is so good I bought it even though it's from Commodore. Why
don't you too?" ;)

The part we are concerned with here is that the DMA channels that provide the
data to the display do NOT have a built in reset mechanism. When the beam
reaches the bottom of the display they will NOT be reset back to the start of
the display.

This is where the COPPER steps in. When the beam reaches the bottom of the
display the COPPER steps in and resets the DMA registers back to the start of
the display.

If you have ever grabbed the top of the screen and yanked it down to reveal
another screen behind then you you have seen the COPPER in action. You see,
you don't have to wait till the bottom of the display to reload the DMA
registers... NOR reload them to the start of the SAME screen... This is ALSO
why two screens don't TOUCH. If you look real close you'll see a scan line or
two of blackness. These black lines are the time it takes for the copper to
switch screens. When switching at the bottom of the display there is TONS of
time though, so you shouldn't have any trouble with that.

Anyway, what I'm saying is that the Amiga already has software in it that
allows it to switch video buffers at a 60hz (or more) rate. The thing to do
is read the RKM and hardware manuals on the subject of driving the COPPER.
It also wouldn't hurt to read the items in the hardware manual about how the
display hardware works, so you know what to do with it when you figure out
the COPPER.

>	I will feed your name to my boss to be added to the list of people
>to file court-imposed restraining orders against :-) :-) :-) :-) :-) :-).
Better watch it Leo or North may point his finger at you next. :-) :-) :-)

Scott Turner
-- 
UUCP-stick: stride!l5comp!scotty | If you want to injure my goldfish just make
UUCP-auto: scotty@l5comp.UUCP    | sure I don't run up a vet bill.
GEnie: JST			 | "The bombs drop in 5 minutes" R. Reagan
		Disclaimer? I own L5 Computing. Isn't that enough?