Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are triangles a gpu restriction or are there other rendering pathways?

To preface this question, I have a competent understanding of OpenGL and the maths behind it, and while I have never touched anything related to DirectX I imagine the concepts are similar.

There is plenty of information around about why triangles are used for 3D graphics (they are necessarily planar, are indivisible except into smaller triangles, etc). However, I would like to know if triangles are merely a convenient way of storing and manipulating 3D data (simpler maths regarding interpolation, etc), or if there is a hardware limitation in the graphics card that only realistically allows the rendering of triangles (e.g. instructions that can essentially ONLY be applied to triangles).

Following on from this, is there any way to achieve pixel-by-pixel control of graphics rendering (as outlined briefly by the answer to this question). While I appreciate direct control over individual pixels is done through a driver, is there any way I can get this kind of control over a rendering environment? Is there away to 'avoid triangles' completely?

like image 285
Ephemera Avatar asked Sep 19 '12 13:09

Ephemera


People also ask

How many triangles can a GPU render?

a modern GPU can handle several billion triangles per second in theory. in practice a few hundred million per second shouldn't be a problem in the normal case. [size="1"]I don't suffer from insanity, I'm enjoying every minute of it.

How does a GPU draw triangles?

Another Digression: How a GPU Draws a Triangle The vertex shader is a tiny program that the GPU executes for each vertex; its job is to read in the coordinates of that vertex and some of the state, and figure out where the vertex will appear on the screen.

Is rendering CPU or GPU dependent?

Traditionally, most computer graphics renderings have relied solely on powerful CPUs, but today, fast video cards with large amounts of RAM can take on the task of rendering and speed up look development of the final scene. In 3ds Max, the Scanline and ART (Autodesk Ray Tracer) render engines use CPU rendering only.

Does rendering depend on GPU?

GPU Based Rendering And GPU Focused Render Engines For one, GPUs are much better at 3D rendering than CPUs because they're optimized for graphical computations and parallel processing. This means that they are able to process many tasks simultaneously, unlike CPUs which operate serially.


1 Answers

Yes and no. Kind of.

Current GPUs are designed to render triangles because triangles are nice to work with. And because current GPUs are designed to work with triangles, people use triangles and so GPUs only need to process triangles, and so they're designed to process only triangles.

As you say, triangles just have advantages that make them convenient to use. GPUs can be made (and have been made) to render other primitives natively, but it's just not really worth it. If you tell a modern GPU to render a quad, it splits it up into two triangles and renders those.

Not because there's a technical reason why a GPU can't render quads natively, but because it's not worth spending transistors on. It's much more useful to focus the GPU on doing triangles as fast as possible, and then just emulate other primitives if they're needed.

So yes, modern GPUs have hardware limitations so they don't work with quads, for example, but not because it's impossible to design a GPU which works with quads. It'd just be less efficient to do so. :)

As for "avoiding triangles", sure, that's basically what the fragment shader does: it fills in one single pixel. The GPU just runs it a few million times in parallel to fill in the entire screen. You could draw two big triangles, which form a quad filling the entire screen, and then just specify a fragment shader which fills that with the content you like.

If you want more control over the process, do it in software instead: paint one pixel at a time to a memory surface, and then load that as a texture on the GPU. But it's slow. :)

like image 98
jalf Avatar answered Sep 26 '22 09:09

jalf