Here's a screenshot of the next Propeller's texture mapping in action.
Each cog has an instruction for doing Z-corrected texel lookup (from a texture stored in cog RAM),·color lookup (16 bits from the cog CLUT), pixel lighting for individual 5:5:5 R:G:B, and alpha blending with whatever pixel is in the D register at the time the PIXF instruction executes. The PIXF instruction does all the above, updates all deltas, and returns the blended pixel into the high word of D, while moving the previous high word into the low word,·so that a subsequent PIXF takes care of the other 16-bit pixel that was in D. Each PIXF takes 2 clocks, or just one clock if the CLUT returns 0 for transparency, in which case the original pixel in D is left in its original state, though moved to the high word. This video image was generated on the fly, with no buffering - just a little program that does two PIXF's followed by a WAITVID for every two pixels. Textures can be 1, 2, 4, or 8 bits, with X and Y dimensions of 2, 4, 8, 16, 32, 64, 128, or 256. Of course, if you try to do an 8-bit 256 x 256 texture, it will just wrap around the cog memory. You have to be reasonable.
In this image, there is a 4-bit 32 x 32 texture map with pixel lighting going from 100% to near 0% top to bottom and alpha blending with white going from 0% to near 100% left to right.
Thanks to Andre LaMothe for spending many hours with me on the phone until I understood what was needed for 3D texture mapping. In the end, it's pretty simple, but without Andre's help... forget it. He's already spent his life figuring out this stuff so that he's able to explain it to someone like me, and I don't have to go through the months (or maybe years) it would have taken me to get a handle on this, all·by myself.
Post Edited (Chip Gracey (Parallax)) : 4/20/2010 6:22:35 AM GMT