Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 25 Jan 1997 14:33:56 -0700 (MST)
From:      Terry Lambert <terry@lambert.org>
To:        jehamby@lightside.com (Jake Hamby)
Cc:        hasty@rah.star-gate.com, multimedia@freebsd.org, hackers@freebsd.org
Subject:   Re: New Bt848 Video capture driver for FreeBSD
Message-ID:  <199701252133.OAA00739@phaeton.artisoft.com>
In-Reply-To: <Pine.BSF.3.95.970125093902.322A-100000@hamby1> from "Jake Hamby" at Jan 25, 97 09:42:44 am

next in thread | previous in thread | raw e-mail | index | archive | help
> For the record, somebody wrote a bt848 driver for BeOS, and there's a demo
> of the new 3DKit which allows you to drop live video and/or QuickTime
> movies onto the faces of a 3D object (cube, sphere, pulsing thing, book
> pages), and spin it around in realtime.  It looks _real_ sweet playing
> about 6 QT movies simultaneously on a PowerMac 8500, all texture-mapped
> onto various 3D objects, but a live video feed is even cooler.  Man, I'd
> love to have the source code to that! 

I bet you $1 that they are only transferring data for the one, two, or
three visible faces of the cube.

You could easily render a projection matrix to do this:

o	Start with a cube showing one face (ie: the vector from
	your viewpoint through the center of the cube is perpendicular
	to the plane of the face).

o	Declare that you will only perform an x, y, or z rotation
	about the center of the cube body.

o	Determine the center of the cube face.

o	Pick one corner of the face.

o	Rotate the corner around the face to describe a circle.  No
	matter how much you rotate the cube itself about its body
	center, you will not need to draw a pixel outside this circle,
	ever.

o	Divide the circle into pixels.

o	Consider the circle as the projection of a sphere into two
	dimensions.

o	You will move the corner of the cube along the visible surface
	of the sphere.  Doing this will reveal a polygon for each of
	the visible sides.  For instance, if you rotate the cube solely
	in the z-x plane from left-to-right, you will start with the
	full face, and then slowy move the left edge until it becomes
	the right edge (a 90 degree rotation) and you will end up
	with a different full face.

o	Now create a matrix of however many pixels are in the circle
	for each pixel in the circle.  Each element in the matrix needs
	to have the values id, x, and y.

o	Fill in this matrix by moving the corner of the cube to every
	pixel in the circle.  id is 1, 2, or 3; its the number of the
	face you see in that pixel on the circle for any given location
	of the corner.  The cube face you start with is id 1.  Put a
	zero in if there is no cube face under that pixel at that time
	(for instance, if you start with one face facing the viewer,
	there will be four crescents with id 0 in them).

o	Each of the faces will look like a four-sided polygon; this
	polygon is actually the projection of a square.

o	If you look at the cube face unrotated, you will have a
	square grid of pixels.  For each polygon, you need to project
	the square into the polygon.  The x,y location of the pixel
	you see for a given projection is the x,y location you store
	in the matrix for that "square".

o	Now you can "rotate" the cube.  When the leading corner moves,
	you pick the matrix for its new location.  Then you draw each
	pixel in the circle (if there is no cube there, there will
	be an id 0, and you should draw the background color) by
	going to the quicktime picture source for the id, and getting
	the pixel at the x,y location from the quicktime image.

o	What if you want to rotate the cube so the image goes upside
	down?  For each 90 degrees you rotate the image, the image
	can be projected rotated.  So you establish four matrices
	of a cube face each in size.  For a 0 degree rotation, you
	pick the first, for a 90 degree, you pick the second, and so
	on.  Now when you go to look up the image, you look up the
	image for the id, and then you look up the x,y pixel in the
	appropriate matrix.  If it's 0 degrees rotated, it gives
	you the same x,y value to look up in the quicktime image...
	if not, though, you will get a rotated pixel.  For instance,
	say my cube face is 100 pixels by 100 pixels.  I want to
	look up pixel 1,1 from the quick time image 0 dgrees rotated:
	I get 1,1.  I want to look up 90 degrees rotated, I get 100,1;
	I want 180 degrees, I get 100,100, and 270 dgrees, I get 1,100.


o	When the corner moves around "behind" the sphere, then a new
	corner will move into the visible cube.  When that happens,
	you will need to reset the matrix, and pick a different
	set of quicktime sources for 1, 2, and 3.  To do this, you
	need to have a matrix of 8 (one for each corner) by six
	(one for each face).

o	For more complex rotations, you will rotate the cube center
	as if it were attached to an axis with a fixed center by
	moving the cube center relative.  This is topologically
	equivalent to rotating the cube about any point.  You will
	need to make another matrix for perspective, since if you
	rotate about a point other than the body center, the average
	distance to the body center will get farther (the cube will
	"get smaller") or closer (the cube will "get larger").


					Regards,
					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199701252133.OAA00739>