Isometric trigonometry and the NES pixel aspect ratio

A place for your artistic side. Discuss techniques and tools for pixel art on the NES, GBC, or similar platforms.

Moderator: Moderators

Post Reply
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Isometric trigonometry and the NES pixel aspect ratio

Post by tepples »

A couple years ago, Bananmos expressed disappointment that my Russian Roulette tech demo was text-based. Around the same time, I started learning to use Blender. So lately I've been doing some 3D modeling for a graphical refresh, when I noticed this:

The video chips in several classic consoles from the ColecoVision through the Super NES all output pixels at 315/88*3/2 = 5.37 MHz. At this dot rate, the BT.601 clean aperture* is 280x240 dots, making each dot an 8:7 rectangle (source).

The right triangle with legs 1 and 2 units has a hypotenuse √5 = 2.236 units, and the smallest angle θ is arctan(1/2) = 26.565°.

Code: Select all

              _,o
          _,-'  |
      _,-'      |
  _,-' θ)       |
o-------o-------o
Now take an orthographic projection of 3D space into 2D and rotate it so that the camera points 26.565 degrees down. Adding the plane of the camera to the diagram produces this view, seen from the left side:

Code: Select all

             \
              \
               \
              _,o
          _,-'  |\
      _,-'      | \
  _,-' θ)       |  \
o-------o-------o
At this angle, a vector two units back and a second vector one unit up would project to the same length. This length is slightly smaller than the length of a vector along the plane, just as the long leg of the triangle is slightly smaller than the hypotenuse.

How much smaller? For an angle with tangent t and cosine c, it is a trigonometric identity 1 + t² = 1/c². But the above triangle was designed such that tan θ = 1/2. So if the hypotenuse of the above triangle is 1 unit, the long leg is 2√5/5 = 0.8944. This is just 2% longer than 0.875, the height of a scanline in pixel-widths. So at this angle, 16 pixels to the right, 16 pixels up, and 8 pixels front to back represent very close to the same distance.

And this is how the viewpoint works in a lot of "isometric" games for these consoles, such as Snake Rattle 'n Roll, Solstice, and the Genesis version of Viewpoint.

Should I also run the analysis for a different angle that might work better for the 320x224 mode of the Genesis and PS1 (clean aperture is 350x240) and quarter D1 (352x240)?

And this is what I came up with in Blender:
Image



* In before kyuusaku mentions pre-BT.601 standards.
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Isometric trigonometry and the NES pixel aspect ratio

Post by tepples »

And this is what I get when I reduce it to NES specs:
Image
Bananmos
Posts: 552
Joined: Wed Mar 09, 2005 9:08 am
Contact:

Re: Isometric trigonometry and the NES pixel aspect ratio

Post by Bananmos »

Those 3d characters actually look pretty nice, and with some careful retracing&retouching work you'll probably be able to make the NES versions recognizable :)

But is your sprite budget so small that you need to limit yourself to 16-pixel wide characters? What kind of view are you considering for your game? Top-down or sideview-beat'em up ala Street Fighter 2?
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Isometric trigonometry and the NES pixel aspect ratio

Post by tepples »

As I wrote above, it's top down in the sense that pressing up goes north, like in an "isometric" game. I'm not tile limited, as I have plenty of CHR RAM. But I'm limited to 16px wide characters for the same reason as RC Pro-Am or the Kunio games. If I were to step up to 24px wide, then four characters on a line, or two characters and a bunch of things on the ground or in the trees, would cause horrible flicker. The only way I could extend the budget is by ditching the NES.
Bananmos
Posts: 552
Joined: Wed Mar 09, 2005 9:08 am
Contact:

Re: Isometric trigonometry and the NES pixel aspect ratio

Post by Bananmos »

But what kind of setting are you looking for in your graphical reboot of Russian Roulette? Four players facing it off by passing the gun around, with no ability or need to walk around? In that case you could be creative by limitations, and try to carefully place them in a circle wide enough as to not cause flicker...

But then again, I may be totally missing the look you want to have in this game?
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Isometric trigonometry and the NES pixel aspect ratio

Post by tepples »

Multiple rule set support is part of it. This is for HHCO, and I could change the art style for different rule sets, but only as inspiration comes. I may post mockups as I get time.
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Isometric trigonometry and the NES pixel aspect ratio

Post by tepples »

This is what I was planning to plug the sprites into:
Image
3gengames
Formerly 65024U
Posts: 2284
Joined: Sat Mar 27, 2010 12:57 pm

Re: Isometric trigonometry and the NES pixel aspect ratio

Post by 3gengames »

That looks really good IMO!
Bananmos
Posts: 552
Joined: Wed Mar 09, 2005 9:08 am
Contact:

Re: Isometric trigonometry and the NES pixel aspect ratio

Post by Bananmos »

So just redesign your map a bit to move the two bottom characters a bit down so they will never be on the same scanline as the cherries in the trees, and you can make them 24 pixels or maybe even 32 pixels, wide which would look a lot nicer IMO. Don't think any player would even notice that your aestethic choice comes from a hardware limitation, except for the few hardware geeks on this forum :)
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Isometric trigonometry and the NES pixel aspect ratio

Post by tepples »

tepples wrote:Should I also run the analysis for a different angle that might work better for the 320x224 mode of the Genesis and PS1 (clean aperture is 350x240) and quarter D1 (352x240)?
I did so for the record.

Strictly, "isometric" refers to a parallel projection along the diagonal of a cube, from one corner to the opposite corner. This means one unit northeast plus one unit northwest projects to the same as one unit up. The triangle in this case would have a base of √2, the length of the bottom face's diagonal, a height of 1, and a hypotenuse of √3, the length of the cube's diagonal. The slope is 1/√2 = 0.7071, and the angle of the image plane is arctan(1/√2) = 35.2644 degrees down from horizontal.

Code: Select all

      _,o._
  _,-'  .  `-._
o:_        (θ _:o
|  `-._ ' _,-'  |
|      `o'      |     _,o
|  , '  |  ` .  | _,-:  | θ
o._     |     _,o'   `--|   
   `-._ | _,-'        +-+
       `o'------------+-o
All right angles in the cube project to 60 degree angles (θ) or 120 degree angles (2θ), whose sine is √3/2 = .866. So one unit northeast and one unit southeast project to .866 of the length of two units up.

The 160px, 320px, or 640px mode of the Apple II, Atari 2600, IBM CGA, Amiga, and many other second-generation home computers and game consoles outputs one, two, or four dots for each cycle of the color subcarrier: 315/88 MHz. For example, two dots per cycle produces a pixel aspect ratio of 6:7, or 0.857, very close to the ideal.

The 320px mode of the Sega Genesis squeezes 320 pixels in the same time as 256 pixels of the TMS9918 family, meaning pixels are only four-fifths as wide as they are in 256px mode. This gives it a pixel aspect ratio of 32:35 (0.914) instead of 8:7. This is a bit wider than the expected 0.866.
slobu
Posts: 276
Joined: Tue Jul 12, 2011 10:58 am

Re: Isometric trigonometry and the NES pixel aspect ratio

Post by slobu »

As a side I wonder if your research could go into a tile editor with realtime conversion between top-down and isometric tiles like in IsoEdit for Project Zomboid
http://theindiestone.com/binky/2011/12/ ... nd-things/
Post Reply