theory - 3d graphics: Rasterizing triangles -


this theoretical question.

let's want draw triangle on screen. if supply vertex shader 3 points in 3d, convert them 3 points in 2d, in window coordinates, or screen coordinates. 3 pixel coordinates on monitor or display.

how, here, graphics pipeline go filling in triangle, based on 3 points? guess this:

  1. bound triangle box determining upper , lower bounds x , y so: enter image description here

  2. use bresenham's line algorithm draw 3 edges of triangle 3 different colors. cannot use regular color buffer step.

  3. do every row of pixels in box: start leftmost pixel (in whereever stored results of step 2), go right until hit edge. now, keep going right, coloring pixels in (running fragment shader), , writing regular color buffer, until hit different line (hitting different colored pixel in whereever results of step 2 stored). stop , go next line.

  4. draw edges fragment shader in regular color buffer.

this seems complicated , inefficient solution. how done?

have @ scanline algorithm. it's moving horizontal line top bottom, calculating 2 intersections of scanline triangle, drawing line between these 2 points.


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -