Comparing x, y Curves and Z-Order Curves for Texture Coding
This Demonstration compares , ordering of pixels in a texture to -order (Morton order). The -order maps two-dimensional data to one dimension while preserving nearness of the data points. The vertical line on the right represents the order in which the pixels are stored in computer memory. The red arrow points to the color under the locator on the left. The "color range" control lets you see what part of the texture is encoded by any region of the 1D array.
Textures (images) are displayed on computer screens as 2D grids of pixels. Computer memory, however, is inherently one-dimensional, so the pixels in a texture must be ordered in some way to allow a computer to store it in memory. The standard ordering is, of course, row-by-row, column-by-column (henceforth ", ordering"), which is fine for most cases. However, it is ill-suited for a particular operation that is used often in some high-intensity situations (like HD games): accessing a rectangular region of a texture. (This is necessary if, for example, the rest of the texture is offscreen, or hidden behind something else.) If the pixels in the texture use , ordering, the computer would need to read the part of the array representing the first row of the region, then skip ahead to the second row of the region, then skip ahead to the third, and so on; that is, it would need to skip ahead once for each row in the region it wants. This skipping prevents the GPU (graphics processing unit—the computer chip that handles graphics) from taking full advantage of certain speed optimizations available to it. Thus, strategies for minimizing the need for these long jumps have been invented. They involve storing the pixels in a different order—one that tends to keep contiguous regions of the image more-or-less together, better than , ordering would.
Snapshot 1: -order for a image of an aurora
Snapshot 2: , ordering for a image of trees, with tiling
Snapshot 3: , ordering for a image of peppers, with tiling, and two rows of tiles highlighted
Special thanks to the University of Illinois NetMath Program and the mathematics department at William Fremd High School.
All images used in this Demonstration are licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license, with the exceptions of "Polarlicht 2" (which is in the public domain) and "Jamnik 05" (which is licensed under the Creative Commons Attribution-Share Alike 4.0 International license).
 F. Giesen, "Texture Tiling and Swizzling." The ryg Blog (blog). (Jun 13, 2016) fgiesen.wordpress.com/2011/01/17/texture-tiling-and-swizzling.
 J. J. Harrison. "Merops leschenaulti - Kaeng Krachan." (Jun 13, 2016) commons.wikimedia.org/wiki/File:Merops_leschenaulti _-_Kaeng _Krachan.jpg.
 J. Strang. "Polarlicht 2." (Jun 13, 2016) commons.wikimedia.org/wiki/File:Polarlicht_ 2.jpg.
 D. Iliff, "Island Archway, Great Ocean Rd, Victoria, Australia - Nov 08." (Jun 13, 2016) commons.wikimedia.org/wiki/File:Island_Archway,_Great _Ocean _Rd,_Victoria,_Australia _-_Nov _ 08.jpg.
 M. Grmek. "Jamnik 05." (Jun 13, 2016) commons.wikimedia.org/wiki/File:Jamnik_ 05.jpg.
 S. Krause. "BMW S1000 RR Studio." (Jun 13, 2016) commons.wikimedia.org/wiki/File:BMW_S1000 _RR _Studio.JPG.
 L. Viatour. "Plasma Lamp." (Jun 13, 2016) commons.wikimedia.org/wiki/File:Plasma-lamp.jpg.