Thursday, August 20, 2009


Ok, for a compter game we are working on we need to record full HDMI video to make a marketing trailer. My current computer could not handle it at all.

First the math: HDTV is 1290 x 1080 at 24 frames per second.
That works out to 1.4 MPixels at 3 bytes per pixel is 100 MB per second.
But there is also sound and some other overhead.

So we went to NewEgg and bought parts:
  • RAIDMAX SAGITTA 2 ATX-928WB Black case. (Cool blue lights!)
  • ECS Black Series A790GXM-AD3 AM3 AMD 790GX HDMI ATX AMD Motherboard
  • AMD Phenom II x4 955 Black Edition Deneb 3.2 Ghz AM3 socket Quad-Core CPU
  • 6 GB Ram
  • 4 SATA Western Digital Caviar 160 GB Drives
  • Vista Home Premium 64 Bit
  • DVD SATA Drive
  • A Screen 22" wide screen
  • RAIDMAX 630W Power supply (More nifty blue lights)
  • Silver Thermal Past (not needed)
  • Cables etc.
The total was 1005.34 USD

We also have a BlackMagic Intensity Pro for 200 USD. This is a HDMI video grabber card and claims to be able to suck up full HDMI video.

So it all showed up in about 3 days. Lots of boxes.

We put it all together.

Then configured it in the BIOS for RAID 5. That was a mistake. RAID 5 means that 3 of the 4 disks are used in parallel for reads and writes, and one is used for parity error correction. This makes it more reliable. After all the install and config, we put in the disk speed test program that came with the Intensity Pro, and we were getting about 350 MB per second read, but only about 50 MB/Sec write. It would never do for what we needed.

(I think the parity generation was slowing it down.)


We reconfigured for RAID 0 with all four disks. This uses all 4 disks in parallel for reads and writes. After a complete reinstall of Vista etc. we ran the disk test again.

450 MB/Sec read and write.


This box is amazing. The click and open on programs is almost instantaneous.


Tuesday, August 11, 2009

XNA Screen Projection

In XNA there is a method,

Vector3 GraphicsDevice.Viewport.Project(Vector3 source, Matrix projection, Matrix view, Matrix world)

that converts a world point to screen coordinates.

The return value is a Vector3. The X and Y is the screen location of the point. It may not be
within the GraphicsDevice.Viewport if the object is "off screen".

One point of possible confusion is the Z part of the return value. It is the depth into the Z buffer.
Your projection matrix has a near and far plane. A Z value of 0 is right on the far plane and is very far away into the screen. A Z value of 1 is a point near the observer, right on the screen plane.

A value of 0.5 would be half way between the far and near planes.

If the Z value is greater than one then the point is behind the observer.

After calling Project, you should check the Z value and if it is greater than 1 then don't draw anything.

Note: if the Z value is > 1 then that means that X and Y must be negated to figure out where the object is relative to the screen. This is important if you are doing a "Mario Smash Bros." style arrow that points off screen at an object that has flown off the edge. But Smash Bros has it easy because no objects ever can get behind the observer.

The reason that X and Y have to be negated is simple. Imagine that the object is behind your head while you are looking at the screen. Draw a line from the object, through your head, to the screen. That is the screen location of the object.

Note: UnProject is a method that does the inverse of Project. It converts a screen location (don't forget the Z part) to world space.