UnderwareDESIGN

PlayBASIC => Show Case => Topic started by: kevin on November 18, 2005, 11:55:19 AM

Title: Linear Texture Mapping
Post by: kevin on November 18, 2005, 11:55:19 AM
This is piccy of another more complex and yet old skool  PB demo.  The demo  uses  TextureTri (https://playbasic.com/help.php?page=GRAPHICS.TEXTURETRI) to fill a simple 3d cube object.   Since PB is primarily a 2d language, the example handles the rotation/projection and rendering in code.  

 While the actual pixel rendering is performed with TextureTri (https://playbasic.com/help.php?page=GRAPHICS.TEXTURETRI).  Prior to rendering, the faces need to be split  in order approximate the perspective curve better, since TextureTri (https://playbasic.com/help.php?page=GRAPHICS.TEXTURETRI) is a linear mapper (doesn't consider depth).   So each face is split twice, which gives improved image quality at medium-> far distances (at far distances you don't need to split as much) , but you'd need more sub-division in order to approximate the curve better when the object is really close to the camera.  but ya get that :)

 The demo sources includes both the sub-divided mapper and the purely linear mapper. Where you can see the classic slipping/distortion effect.