When creating for the DS, there are a number of considerations to bear in mind. This page outlines some of these restrictions.


Different restrictions are imposed by the 2D and 3D engines.

2D Graphics#

Mario Kart DS solely uses text mode backgrounds and character based objects. In 4-bit and 8-bit graphics, each 8x8 tile may use 15 or 255 colors at most respectively. With text mode backgrounds, a hard limit of 1024 characters is imposed by the 2D engine background screen format. It is due to this that local maps must have their tile count reduced. For smaller menu backgrounds and such, which are typically 4 bits in depth, the limit is smaller, and exceeding it will cause graphics data to overflow into graphics used by other things (such as the screen data itself).

With 2D objects, there can be a maximum of 128 on-screen at a time. The maximum number on a single scanline depends on the size of the objects and where they are. The 2D engine allots 2124 or 1530 cycles for object rendering depending on whether OBJ processing during H-blank is enabled or not. Each pixel of a normal OBJ takes 1 cycle, and each pixel of an affine OBJ takes 2 cycles. Affine OBJ have an overhead of 10 cycles, and OBJ that exist partially off the screen have an overhead of 2 cycles.

3D Graphics#

The DS allows for native rendering of both triangles and quads. Using quads makes more efficient use of polygon memory, and may make more efficient use of vertex memory. It is important to note, though, that the hardware does not allow for concave quads. When a gap in the polygon exists on a scanline, only the first portion of the quad is rendered on that scanline. Quads should also generally be kept relatively planar. Bending them may result in texture distortion or disappearing entirely.

The DS also allows for polygon stripping. Rather than sending shared vertices between two polygons twice to the geometry engine, it allows for the last two vertices sent to be the first two vertices of the next polygon. This reduces the amount of vertex memory needed to store the geometry.

The most prominent of the 3D hardware limitations is the maximum polygon count. The maximum number of polygons that can be rendered on-screen on any frame is 2048. Different factors may reduce this number, however. Using exclusively quads, for example, affords a maximum of 1706 on-screen, due to the size of polygon memory. It is important to note, though, that the rendering engine runs independently of the main CPU, and as such, does not cause it to lag.

The limit on vertex memory is 6144 vertices. Because of this, by using only separate quads, only 1536 can be drawn on-screen. With a quad strip, the full 1706 may be drawn. The full 2048 triangles may be drawn regardless of stripping.

In addition to restrictions on the number of polygons in a single frame, there are also restrictions imposed on the number of polygons in a single scanline. When too many exist on a scanline, the rendering engine will just stop rendering polygons on that line, leaving tearing artifacts. The number of polygons that can be drawn on a single line will vary between 8 and 132, depending on how many pixels that polygons takes up horizontally on that scanline. Of a total of 2126 cycles afforded to rendering one line of 3D graphics, where each pixel of a polygon takes one cycle, and each polygon itself takes 8 cycles of overhead. Since the rendering engine uses a 48-line buffer, however, these may not end up being exact.

Texture sizes can be any power of 2 between 8 and 1024. In the case of 4x4 compressed textures, though, the maximum size is either 1024x512 or 512x1024 due to VRAM layout.

Translucent polygons can pose a problem when it comes to rendering priority. When a translucent polygon is being drawn, its pixels will not be written over pixels of another translucent polygon unless it has a different polygon ID than the existing one. Accommodating this in Mario Kart DS will require some special code changes.



Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-2) was last changed on 20-Apr-2023 23:24 by Garhoogin