Frustum Culling: No. of Polygons drawn

Started by
0 comments, last by Bacterius 12 years, 4 months ago
I'm trying to implement frustum cull techinque in the vertex shader itself. What i'm trying to do is, only pass those vertices to the pixel shader which lie in the frustum cone. But the problem is i dont know how to get the number of polygons drawn so as to see if the technique is working or not, whenever i move the camera. I'm using a really fast GPU so i dont think a few polygons will affect the fps count so i don think i can use fps count so as to check the performance gain

What i wanna know is there any function or technique to query the number of polygons or tris drawn on the screen.

I'm working in C++ using DirectX and HLSL.
Advertisement
You are not actually doing anything. The GPU already culls any triangle that turns out to be outside the view frustum, faster than you could ever do it in a shader, right before the pixel shader stage. So you are effectively not doing any work. Frustum culling is done on the CPU side, not triangle by triangle obviously but either by big chunks of triangles (test the bounding box of those triangles, and if this bounding box is outside the frustum you don't even need to send all those triangles to the GPU via a draw call since they will end up off the screen), or via a quadtree/octree for maximum performance. The only point of frustum culling is to avoid sending the vertices to the GPU in the first place, along with doing useless vertex shader work for those vertices which won't end up being filled.

On topic however, you are trying to query the pipeline statistics of your GPU, which return information such as number of vertices sent to the GPU, number of vertices rasterized, number of pixels filled, etc... you should be able to find some code examples now that you know the keywords.

“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”

This topic is closed to new replies.

Advertisement