opengl - Is it possible to have face culling before the geometry shader stage? -


is possible front facing triangles sent geometry shader? believe culling happens emitted triangles after geometry shader default.

yes is, in ancient days of quake, face culling done on cpu using simple dot product per-triangle. triangle failed test not included in list of indices drawn.

this not viable optimization on hardware these days, still see employed time time in specialized applications. 1 such application have seen lot of using ps3's cell spes cull out triangles during batching save vertex transform workload on ps3's rsx gpu - keep in mind, ps3 still uses basic shader architecture there fixed number of specialized vertex shader units , fragment shader units. balancing shader workload important on gpu.

i may missing point of question though; benefit expect/want out of culling primitives early?


update:

what trying on modern hardware , software, vertex transform / primitive assembly not bottleneck. fragment processing more expensive these days, having primitives culled during rasterization usually extent have worry things performance. ps3's rsx special case, has poor vertex performance , cpu architecture hard keep busy, makes sense offload primitive culling cpu.

you can still cull triangles before vertex shader/tessellation/geometry shader on cpu, storing normals per-triangle somewhere , transferring new set of indices draw each frame hardly makes wise use of resources. may spend more time , memory setting reduced list of triangles of if processed them on gpu , let gl throw backward facing primitives out during rasterization.

there @ least 1 use-case comes mind still useful thing do. referring tessellated patches. if can determine on cpu before tessellation occurs entire patch faces wrong way, can skip having tessellate them on gpu. ordinarily rendering not vertex-bound these days, tessellation 1 case may be.


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -