Inferno #09
31 июля 2006 |
|
Inferno - On the voxel flying elephant IG # 5.
On a flying elephant Voxel - a volume pixel, is maximal cue cube. On the ZX realizable not only to all Voxel-known landscapes such as Mars, but and voxel objects, which can rotate on all axes. In the intro to the 5 th number you IG saw an example of such an object. If the object similar in complexity to that which was in IG # 5 (and there was just a flying elephant) to build a textured polygons, then speed drawing heavily would have fallen. In general terms, how the effect? He works a simple brute force'om. Each Therefore, the direction of view corresponds to a direction vector of a certain length (y I have it about 8 cells), we move steps of this vector, until he met non-empty voxel. Take the color of the voxel and throw it on the screen (more precisely, chunkmap). This simple algorithm I've used yet in 1996 the first piece on Wolf 3d. Then he, however, does not contain any uhisch ments to speed up the scanning and scary inhibited ... The object is described by two cards. The first spacecraft mouth (on it we scan) in the page does not placed due to the fact that the envisaged empty edge - to avoid off-scale. This card is for each pair of coordinates X, Y contains the thickness of the object (Z-coordinate). The second map takes a page and stores color voxel with coordinates X, Y (and higher shown Z). Y corresponds to the senior buy that addresses in a map, X corresponds to the younger th byte of the address. In the second map all addresses more to # 2000. In another page is stack vyvodilka chunks like the one described in the Monster Born Dead # 5. In this If implemented 16 colors, which codes # C0, # c4 ,...,# fc. Since the elephant is symmetric, requires only one Z coordinate for each pair coordinates X, Y. If you want to look at elephant on the other hand, we just do (in early scan a particular screen pixel) transformation: Z0 =- Z0 (Z0 = z-coordinate of the beginning of scanning), dZ =- dZ (dZ = z-scanning step). Both maps were drawn in Photoshop. Drawing process occurred long before writing koda.Poetomu to control the following I drank little program in Delphi, makes it that returns the view cuts the elephant. This gave opportunity to see the "burr" in places with low Z (ie, where poluslon osculating tangent to with his reflection). Seen "Burrs" Naturally, I wore out in fotosho ne. Scanning cycle is as follows: LOOPout EXX ADD IX, BC ADD HL, DE LD A, H EXX LD E, A LD D, HX LD A, (DE) ADD HL, BC JR C / NC, LOOPzro CP H JR C, LOOPQ; DE = YX DEC LY; do no more than 14 steps JP NZ, LOOPout LOOPzro LD DE, zro; found nothing RET Generally these cycles in the program 4 shtu ki, under different situations (taking into account variables progress with Z> 0 in Z <0 and vice versa). Address DE = zro (There is a black pixel) is different from All other scan results to those that it is less than # 8000. If we scan all directions (44 * 44 = 1936 pieces), then the effect would give no more than one frame per second. This problem been solved by interpolation. In the first place - fine interpolation (Blur): blur obtained by scanning derivations X, Y coordinates by 1 pixel. (She comes to mind first, but you holds, then it is in the least!) To implement the interpolation results The results of scanning (X, Y coordinates in the volume KTA) we do not use immediately, and put in array SCANS. The size of this array ((HEIGHT / 2) +1) * (WIDTH +1) words where WIDTH - the width of the screen in the familiarity (Pairs of chunks), and HEIGHT - its height in chunk. Here, an order to be able to to average the right and bottom edges kartinki.Na these parts is always an array contains the value zro, we did not scanning em.Kak you might guess from the size, in this array of pixels are having only odd nye screen coordinates, while the remaining pixels whether the computed blur in the process of filling of chunkmap'a (cycle read0). But realistically, scanning is not a pixel, and by 3 pixels (the cycle scan0). A rough interpolation (cycle ish0) interpolates induces its rezultaty.Chtoby obtained from these the results of the scan results ostensibly through the pixel, has a simple nedostanochno razmazyvaniya.Dlya some pixels to an usual additional scan (cycle fill0). Here the following scheme: S1S 121 S1S where S = SCAN, 1,2 = handling: if all neighbors <> Zro or all = zro, then the cell is interpolated is, or scanned. Sign "as well, ska niruy this cage! "transferred from the cycle ish0 cycle fill0 as the value of X =- 1. If a rough interpolation is disabled, X =- 1 transmitted in all cases (on the button "S" to tags MAYBEJP placed team unconditional sition). Source - as usual, in the appendix. You can even accelerate, if we double step scan. Then after crossing the boundary boundary of the object should look, if not crossed We object to a half-step ranshe.Esli so, in zvraschaem as a result of scanning of this zapolshagovuyu coordinate. So work melts scanning Wolf2004. Lack of a dual-scan is that it can cut corners and fine detail. However, texture in large parts it is imposing em right. Alone Coder
Other articles:
Similar articles:
В этот день... 21 November