Jump to content

  • Log In with Google      Sign In   
  • Create Account

How to: Culling


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 thecheeselover   Members   -  Reputation: 330

Like
0Likes
Like

Posted 13 January 2014 - 06:27 PM

Hello,

 

I don't understand how to apply culling in my opengl application. I understand what is the concept, but not the how to. First off, what is the difference betwenn GL_FRONT and GL_CW? To make culling properly, do I need to order my vertices' position clockwise or to order the indices? What is the reference of clockwise (i.e. is it when I face the -z axis or something else?

 

Thanks a lot,

Thecheeselover


Hide yo cheese! Hide yo wife!

Sponsor:

#2 richardurich   Members   -  Reputation: 1187

Like
1Likes
Like

Posted 13 January 2014 - 07:48 PM

Are you using the fixed-function pipeline? If you're following a tutorial and don't mean to be using outdated concepts, make sure the tutorial is using OpenGL 3 or 4. You can find that when they set major version to either 3 or 4. In SDL, it's SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3 or 4). For WGL, I think it's WGL_CONTEXT_MAJOR_VERSION_ARB. You probably get the idea.

 

For what clockwise means (from http://www.opengl.org/sdk/docs/man/xhtml/glFrontFace.xml):

"The projection of a polygon to window coordinates is said to have clockwise winding if an imaginary object following the path from its first vertex, its second vertex, and so on, to its last vertex, and finally back to its first vertex, moves in a clockwise direction about the interior of the polygon."



#3 dpadam450   Members   -  Reputation: 928

Like
0Likes
Like

Posted 13 January 2014 - 09:57 PM

Back face culling is on by default I believe. There is also object culling as well.



#4 3TATUK2   Members   -  Reputation: 730

Like
0Likes
Like

Posted 14 January 2014 - 12:12 AM

As dpadam450 said, the type of culling you're referring to is handled automatically by GL...

 

There are other types of culling, like object culling, as he also mentioned.

 

Implementing these methods are pretty advanced topics...

 

Object culling is somewhat easier, for example you can simply wrap an object render call with a GL object occlusion query, then use the previous frame's results to either draw the full version of the object (was visible) or a simplified bounding box version (was not visible).

 

Then there's a system like I've implemented which is basically octree-based occlusion query geometry culling.  First you build an octree from your geometry, then use it's nodes with occlusion queries to determine their visibility, similar to the object-based method described above... But instead of a whole object as a single entity, you're basically breaking a very large object (map geometry) into smaller pieces to be handled individually.

 

Beyond that - there's a system like PVS (Potentially Visible Set) which quake-like engines implement, as well as unity and other mainstream game engines through Umbra.  It's similar to the octree-based method above, but different. First off, instead of an octree, it typically uses just a constant (non-recursive) spatial grid. The major difference is that it doesn't use realtime occlusion queries, but instead is precalculated. Basically, for every grid - it determines which other grids are potentially visible, so then when the camera is in a specific grid, it already knows which other ones to render.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS