|
| 1 | +# 3D Display Control |
| 2 | + |
| 3 | +<style> |
| 4 | +tt { |
| 5 | + white-space: pre; |
| 6 | +} |
| 7 | +</style> |
| 8 | + |
| 9 | +This chapter talks about the registers used to control the 3D display. |
| 10 | + |
| 11 | +<a id="DISP3DCNT"></a> |
| 12 | + |
| 13 | +## DISP3DCNT: 3D display control (0x4000060, R/W) |
| 14 | + |
| 15 | +| Bits | Description | |
| 16 | +|---------|---------------------------------------------------------| |
| 17 | +| <tt>0</tt> | Texture mapping enable (0=Disable, 1=Enable) |
| 18 | +| <tt>1</tt> | Shading polygon attribute (0=Toon Shading, 1=Highlight Shading) |
| 19 | +| <tt>2</tt> | Alpha test (0=Disable, 1=Enable) (see [ALPHA\_TEST\_REF](3d_disp_cnt.md#ALPHA_TEST_REF)) |
| 20 | +| <tt>3</tt> | Alpha blending (0=Disable, 1=Enable) |
| 21 | +| <tt>4</tt> | Anti-aliasing (0=Disable, 1=Enable) |
| 22 | +| <tt>5</tt> | Edge marking (0=Disable, 1=Enable) (see EDGE_COLOR) |
| 23 | +| <tt>6</tt> | Fog color alpha mode (0=Alpha and color, 1=Only alpha) (see FOG_COLOR) |
| 24 | +| <tt>7</tt> | Fog enable (0=Disable, 1=Enable) |
| 25 | +| <tt>8-11</tt> | Fog depth shift (<tt>FOG_STEP = 0x400 >> FOG_SHIFT</tt>) (see FOG_OFFSET) |
| 26 | +| <tt>12</tt> | Framebuffer RDLINES underflow (0=None, 1=Underflow) |
| 27 | +| <tt>13</tt> | Polygon/vertex RAM overflow (0=None, 1=Overflow) |
| 28 | +| <tt>14</tt> | Rear plane mode (0=Use clear color, 1=Bitmap) |
| 29 | +| <tt>15-31</tt> | Unused |
| 30 | + |
| 31 | +<a id="VIEWPORT"></a> |
| 32 | + |
| 33 | +## VIEWPORT: Set 3D viewport (0x4000580, W) |
| 34 | + |
| 35 | +| Bits | Description | |
| 36 | +|---------|---------------------------------------------------------| |
| 37 | +| <tt>0-7</tt> | X1: Left-most X coordinate (0...255) |
| 38 | +| <tt>8-15</tt> | Y1: Bottom-most Y coordinate (0...191) |
| 39 | +| <tt>16-23</tt> | X2: Right-most X coordinate (0...255) |
| 40 | +| <tt>24-31</tt> | Y2: Top-most Y coordinate (0...191) |
| 41 | + |
| 42 | +To fill the screen: X1=0, Y1=0, X2=255, Y2=191 |
| 43 | + |
| 44 | +Note that coordinate (0, 0) is the bottom-left corner of the screen, while ht is |
| 45 | +the upper-left corner of the screen in the 2D graphics engine. |
| 46 | + |
| 47 | +<a id="DISP_1DOT_DEPTH"></a> |
| 48 | + |
| 49 | +## DISP\_1DOT\_DEPTH: Max depth to render 1-dot polygon (0x4000610, W) |
| 50 | + |
| 51 | +When a polygon is too small or too far away it is reduced to a single pixel on |
| 52 | +the screen. This register will determine the cutoff distance that the 3D engine |
| 53 | +will use to determine whether to render them or not. |
| 54 | + |
| 55 | +| Bits | Description | |
| 56 | +|---------|---------------------------------------------------------| |
| 57 | +| <tt>0-14</tt> | Max W value (12.3 unsigned fixed point) |
| 58 | +| <tt>15-31</tt> | Unused |
| 59 | + |
| 60 | +This check can be enabled on a per-polygon basis with bit 13 of POLYGON_ATTR. |
| 61 | + |
| 62 | +The comparison always uses the W coordinate regardless of the buffering mode. |
| 63 | + |
| 64 | +<a id="ALPHA_TEST_REF"></a> |
| 65 | + |
| 66 | +## ALPHA\_TEST\_REF: Alpha test reference value (0x4000340, W) |
| 67 | + |
| 68 | +When alpha test mode is enabled in [DISP3DCNT](3d_disp_cnt.md#DISP3DCNT), |
| 69 | +pixels will only be rendered if their alpha value is greater than the value in |
| 70 | +`ALPHA_TEST_REF`. Normally, when it is disabled, all pixels are rendered if |
| 71 | +their alpha value is greater than zero. A value of 31 will hide all polygons. |
| 72 | + |
| 73 | +This test is done after applying texture and polygon transparency. |
| 74 | + |
| 75 | +| Bits | Description | |
| 76 | +|---------|---------------------------------------------------------| |
| 77 | +| <tt>0-4</tt> | Alpha test reference (0..31) |
| 78 | +| <tt>5-31</tt> | Unused |
0 commit comments