3
\$\begingroup\$

I thinking about rendering into single pixel (1x1) framebuffer. For example we have two triangles which covers whole NDC area, one is green second red.

What color will be written to 1x1 framebuffer? As far as I understend graphic API (no matter which) tries to put whole scene in to given framebuffer, in our example, into single pixel. But I can't figure how GPU will choose what should be written into that pixel.

\$\endgroup\$
  • \$\begingroup\$ Answering this question, don't forget to mention AntiAaliasing \$\endgroup\$ – Kromster Dec 16 '15 at 9:42
4
\$\begingroup\$

If I understand your question right you want to know how the gpu rasterizes polygons from vectors to pixels?

enter image description here

This image shows how Direct3D chooses what pixels to draw, I don't know how OpenGL does it but I imagine it must be something similar.

A pixel is drawn if it's within all edges and/or passes the top-left rule which state that the center of the pixel must lie on the top edge (if present) or on the two left edges (if there is no top edge there may be two left edges, otherwise there's only one).

If we take your example of two triangles, one green, one red, then the single pixel will be the color of the triangle containing most of it.

enter image description here

\$\endgroup\$
  • \$\begingroup\$ Well it is old question but I think again about it and one case is unclear for me: What happen if we have 1x1 pixel render target and very complicated geometry to render for example scene in game, hundreds of models etc. and we render it? As far as I understand rasterization, this one pixel should cover whole NDC area so whole scene should be inside this pixel? What will be written to pixel in that case? Some approximation or what? \$\endgroup\$ – Kacper Kleczewski Apr 15 '16 at 12:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.