View Full Version : Back face culling and hardware
03-14-2001, 04:01 AM
Who should do back face culling the software or the hardware. So should i perform back face culling in software before sending the stuff to be rendered with the card or should I send it all and let the hardware deal with culling.
I am currently using glDrawPrimitive, I just decided to use tri-lists and can't see if there is any way of back face culling them easily.
No offense, but I can hardly think you will be able to cull backfaces faster than the hardware.
What you should do instead, is checking wether the whole object is visible or not, i.e. if it's inside the viewfrustum. That, on ther other hand, can improve rendering speed quite a bit.
03-14-2001, 01:55 PM
Bob, what about if you use an octree/BSP tree and the far nodes/planes are completely obscured by the front nodes/planes and the far nodes/planes contain potentially thousands of triangles? Then you only need to make a few software tests to save on the triangles. I haven't implemented this and tested it against hardware culling myself yet, but I am going to in a visualisation thesis this year and could be rendering millions of triangles so I'm interested in backface culling as well.
if you're using GL_TRIANGLES il'd do backfaceculling before u send them to the card. certainly on my card it makes a difference ±10%
ffish: Backface culling only removes the faces that does not face the viewpoint. Backafce removal is a per-triangle visibility test.
BSP/octrees is an even more advances algorithm, and does not compare with backface culling that well, that operates on the whole scene, and not each triangle. BSP/octrees is used to remove large portions of scene in just a few tests. And because OpenGL is not a scene graph API, there is no function for doing this in OpenGL.
And the question posted was wether it was worth doing backface culling in software or not.
If you can use BSB/octrees/quadtrees to remove large parts in a short time, go ahead and use it. But when it somes to backface culling only, I suggest you let the hardware do it. Especially if you got a new GPU.
03-15-2001, 03:08 PM
One point is that if you do backface culling in software do you perhaps not need to do some state changes that can be expensive. It is certainly best to let OpenGL do the culling if you can afford it.
also that but its mainly to save u not actually giving the triangle to the driver in the first place
eg 2 cases, 2 tris, one is backfacing
-- own backface culling --
test them both -> only send one to the card
-- driver does the backface culling --
gotta send both to the card
believe me this makes a big difference if you're sending a lot of tris to the card over the bus.
the best method is to send as many tris using GL_TRIANGLE_STRIP ( u dont do backface culling in this case obviously )
then any left over tris test to see if they're backfacing and only send the ones that aint
Yes, but to do backface culling, you need to transform all the triangles from local coordinates to world-space coordinates, after that you can perform the actual backface culling. This can be rather expensive if you do it yourself. The hardware/driver will need to transform the geometry anyways (to be able to draw it), so the driver/hardware has to do it wether you want backface culling or not. So if you let the driver do it "on the fly", you can get away with it almost for free on todays hardware.
It is slower to pass more geometry over the bus, but unless your system is geometry limited, the performance hit you get by passing more geometry is generally less than the gain you get by letting the hardware remove backfaces.
[This message has been edited by Bob (edited 03-16-2001).]
>>Yes, but to do backface culling, you need to transform all the triangles from local coordinates to world-space coordinates<<
or just translate your camera to object space http://www.opengl.org/discussion_boards/ubb/smile.gif
Whatever, but it still costs you expensive CPU time http://www.opengl.org/discussion_boards/ubb/rolleyes.gif
Sometimes it is usefull even if you spend some CPU time on it. If you have a very dynamic Mesh, where all the triangles get generated each frame, you have to touch each triangle, and then you can remove all triangles that do not face the camera with low cost.
If you have static geometry it should always be faster, to let the hardware do the culling.
[This message has been edited by Lars (edited 03-20-2001).]
03-23-2001, 09:40 PM
You may find something useful in these extensions:
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.