Scenergy #02
31 декабря 1999 |
|
Coding - Texture mapping + Phong shading implementation of the Senat / Eternity Industry.
Warning!!! I earnestly ask editors to leave Scenergy article unchanged. All responsibility for what has been said, I'll take care of (Senat / Eternity Industry) @ Texture mapping + Phong shading (C) Eternity Industry In this article I will try to explain how to implement this inhibitory effect on the ZX. Instead it you can see in our demuhe "Napalm" (the part where Dangle hemisphere, in her tight texture on the surface of the eye and runs a light flare) on the Amiga This effect has long been implemented in the demo Ramses'a, Mellow Chips, Floppy, Exploder'om, et al. I shall warn that this article is intended for the encoder above average, so everyone there SerzhSoft'am etc. reading is simply forbidden! :) If you understand how to make a texture map and the environment, then This is not coded in the cellar, explains the re-T_MAP just laziness. Incidentally, the same method can be implemented and T_MAP, accelerate shading about 30 percent. Dear coders! if you just want it coded, I advise not to rush to make a start at least Gouraud or T_MAP! I'll start with a basic cycle: POP HL; enters the stack smeschemie in texture Or (c H - step Y, the L - move to X). ADD HL, BC; add it to the coordinates of the lateral ; Line range (in texture), pre- , Calculated from the table and pulled out ; Early drawing Scanlin LD A, (HL); Take the color of the texture. EXX; POP HL; enters the stack offset by a texture , (Light spot) ADD HL, BC; add it to the coordinates of the lateral ; Line range (in texture of the light ; Spot) ADD A, (HL); add up with the color spots LD E, A; because in addition there are more colors , # 10, the color should be the maximum, , Ie # 0F. Tk on ZX is not the team that , With the addition of doing it, then traversed ; Engage in distortion and make the table , Folded flowers. LD A, (DE); Take the resulting color. EXX; LD (DE), A; shoves it into a buffer for output. INC E; That is truncated! Now the arrangement of textures in memory. They should be located in one of the pages (eg # 11) and in the first page of most climbs 4 textures (64 x 64) the first # 40 bytes - the first structure, the second # 40 bytes - the second, third # 40 bytes third ... etc., and through the # 0100 is the same. For example: The total size of X = # 0100 | | | | | | Tekstura | texture | texture | texture | | Svetogogo | for Tmap | for rear | why-| | Spot | | Background | thread more | | | | | | | | | | | Buffer for output must have size 38 x 256 as I I think that the size of Y = 38 is optimal, because at C2P standard screen time to upgrade to 2 frames. Size X = 256 is made to eliminated the need for clipping polygon H. buffer for output, naturally, should located to the # C000 is starting with # 9A00. All precalc'i at the beginning of the main loop are exactly the same as in the usual T_MAP'e, with the difference that the computations needed perform 2 times more than in T_MAP'e (calculation tables steps in texture, tables of steps to the texture of a light spot, interpolate the vertices of the polygon and texture on texture light spots, etc.) Warning! This algorithm will only work with switched off Interrupt! Think a little for yourself how to do so, that does not hang in IM 2;) Well, almost done. As you can see to do T_MAP + PHONG, you must first understand how a normal T_MAP. If there is interest editors, then We (EI) can tell us about the implementation on the ZX effects such as: 3d-camera, Static Phong Shading or Environment Mapping, Morphing Stretch-tables, Z-buffer, S-buffer, alpha-channel, Mirroring rotation, Fast Scaling, 3d-Particles, 3D Spheres 3D Tunnels, Lens Flare, any kind of 3D-shading'a and much more. Senat / Eternity Industry. 18.09.999
Other articles:
Similar articles:
В этот день... 23 November