1 / 19

Wire-frame Modeling

Wire-frame Modeling. An application of Bresenham’s line-drawing algorithm. 3D models. Simple objects from the world around us can be depicted as “wire-frame models”

gordondunn
Télécharger la présentation

Wire-frame Modeling

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Wire-frame Modeling An application of Bresenham’s line-drawing algorithm

  2. 3D models • Simple objects from the world around us can be depicted as “wire-frame models” • We make a list of the “key” points (usually corners) on the object’s outer surface and a list of all the lines that connect them • The “key” points are called “vertices” • The connecting lines are called “edges” • We create a file that contains this “data”

  3. Example: the basic barn 10 corner-points (“vertices”) 15 line-segments (“edges”)

  4. 3D-coordinates Front vertices Back vertices V0=( 0.5, 0.5, 0.5 ) V1=( 0.5, 0.5, -0.5 ) V2=( 0.5, -0.5, 0.5 ) V3=( 0.5, -0.5, -0.5 ) V4=( -0.5, -0.5, 0.5 ) V5=( -0.5, -0.5, -0.5 ) V6=( -0.5, 0.5, 0.5 ) V7=( -0.5, 0.5, -0.5 ) V8=( 0.0, 1.0, 0.5 ) V9=( 0.0, 1.0, -0.5 )

  5. Perspective Projection • We imagine the computer display screen is located between the wireframe model and the eye of someone who’s viewing it • Each vertex is “projected” onto the screen • We use Bresenham’s algorithm to draw line-segments that connect the projections • A “demo program” will show this effect

  6. The projection Y-axis P(x,y,z) P*(x*,y*,0) X-axis View-plane Eye of viewer (0,0,D) D = distance of eye from view-plane Z-axis

  7. Similar Triangles Corresponding sides have proportional lengths C c A a b B a / A = b / B = c / C

  8. Projection: side-view By similar triangles: y* / y = D / (D – z) P(x,y,z) So y* = y / ( 1 – z / D ) P*(x*,y*,0) y y* Eye Z-axis D z View-plane

  9. Projection: top-view D z Z-axis x* x P*( x*, y*, 0 ) By similar triangles: x* / x = D / ( D – z ) P( x, y, z ) So: x* = x / ( 1 – z / D )

  10. The projection equations • Point P( x, y, z ) in 3D-world is “mapped” to pixel P*( x*, y* ) in the 2D-viewplane: x* = x / ( 1 – z / D ) y* = y / ( 1 – z / D ) • Here D is distance of eye from viewplane

  11. Any fixups needed? • If the projected image is too small or too big, it can be “rescaled”: x’ = x*(scaleX); y’ = y*(scaleY); • If the projected image is “off-center”, it can be “shifted” (left or right, up or down): x” = x’+shiftX; y” = y’+shiftY;

  12. animation • The wire-frame model can be moved (or the viewer’s eye can be moved) to show an object from different viewing angles • By redrawing a series of different views in rapid succession, the illusion of animation can be achieved • But erasing and then redrawing a complex object can produce “flickering” that spoils the impression of smooth movements

  13. smooth wire-frame animations • Advanced hardware techniques can be employed to eliminate any “flickering” • One such technique is “page-flipping” • It makes use of the extra graphics VRAM • But it may require us to learn more about the Super VGA hardware designs • And here we must confront the issue of graphics “standards” (or the lack thereof)

  14. SuperVGA The problem of “standards” for enhanced PC graphics hardware

  15. Limitations of VGA • VGA’s architecture was designed by IBM • It was targeted for IBM’s PC/AT machines • These used Intel’s 8086/8088/80286 cpus • Operating system was PC-DOS/MS-DOS • DOS was built to execute in “real-mode” • So address-space was limited to 1MB • VRAM was confined to 0xA0000-0xBFFFF • Graphics-mode VRAM was only 64KB

  16. VGA Modes 18 and 19 • Design-goals of VGA mode 18: higher screen-resolution (640x480, 4bpp) and “square” pixels (16 colors) • Design-goals of VGA mode 19: higher color-depth (320x200, 8bpp) and “linear” addressing (256 colors) • Also “backward compatibility” with CGA/EGA: • CGA mode 6: 640x200, 1bpp (2-colors) • CGA mode 5: 320x200, 2bpp (4-colors) • EGA mode 16: 640x350, 4bpp (16-colors0

  17. IBM competitors • Others sought a marketing advantage • Their engineers devised ways to get more colors and/or higher screen-resolutions • Example: 800x600 with 4bpp (16-colors) • Offers “square” pixels and 64K addressing • 800x600=480000 pixels (“planar” memory) • But every competitor did it their own way! • So PC graphics software wasn’t “portable”

  18. VESA • Video Electronics Standards Association • An industry consortium to setup standards • Their idea: provide a uniform programming interface for Super VGAs via the firmware • Applications would not directly program the incompatible graphics hardware, but would call standard ROM-BIOS functions supplied in firmware by each manufacturer

  19. VESA Bios Extensions v3.0 • Copy of the standards document is online • It defines a programming interface for the essential and the most-needed functions • Examples: setting various display-modes, querying the hardware’s capabilities, and enabling SuperVGA functionalities • Reading assignment: study ‘vbe3.pdf’

More Related