Horde3D

Next-Generation Graphics Engine
It is currently 25.11.2024, 21:39

All times are UTC + 1 hour




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: occlusion culling
PostPosted: 25.08.2008, 11:56 
Offline

Joined: 10.04.2008, 09:13
Posts: 86
What should be the performance increase of occlusion culling?
I've created a small demo based on the Knight demo that only reduces about 20-30% of tris.

http://corrado.bsdwebhosting.com/~jimbo/cullingtest.zip


Top
 Profile  
Reply with quote  
 Post subject: Re: occlusion culling
PostPosted: 26.08.2008, 01:35 
Offline

Joined: 08.11.2006, 03:10
Posts: 384
Location: Australia
The performance increase is heavily dependent on the scene. I wouldn't expect too much of an increase in the Knight scene as it doesn't involve that many objects.

In a scene with a lot of objects which could be occluded I would expect a bigger speed-up, especially if the culled objects have expensive vertex shaders (such as skinning).


Top
 Profile  
Reply with quote  
 Post subject: Re: occlusion culling
PostPosted: 26.08.2008, 06:32 
Offline

Joined: 10.04.2008, 09:13
Posts: 86
The demo I've linked contains 100 crates in rows and columns, it's not the knight demo.


Top
 Profile  
Reply with quote  
 Post subject: Re: occlusion culling
PostPosted: 26.08.2008, 07:03 
Offline

Joined: 08.11.2006, 03:10
Posts: 384
Location: Australia
Ahh sorry. I've actually looked at your test scene now, and it seems Horde's Occlusion Culling doesn't work as well as it should.
For instance, if I move the camera to the corner of the boxes and zoom right in (so only one box is visible), most of them still aren't occluded. Then I move the camera to the opposite corner and do the same thing, but this time *no* boxes are occluded at all. This seems to suggest that it is dependent on the order in which the boxes are rendered...


Top
 Profile  
Reply with quote  
 Post subject: Re: occlusion culling
PostPosted: 26.08.2008, 14:14 
Offline

Joined: 22.11.2007, 17:05
Posts: 707
Location: Boston, MA
DarkAngel wrote:
This seems to suggest that it is dependent on the order in which the boxes are rendered...
Isn't that how occlusion culling is supposed to work? You need to sort the scene front-to-back before rendering.

_________________
Tristam MacDonald - [swiftcoding]


Top
 Profile  
Reply with quote  
 Post subject: Re: occlusion culling
PostPosted: 26.08.2008, 20:09 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
To be added to the manual:

Code:
Occlusion Culling

Occlusion culling is an optimization technique that makes it possible to cull objects that are not visible since they are hidden/occluded by other objects. Horde3D uses hardware occlusion queries for its occlusion culling implementation. These queries have a delay of one frame to avoid stalls that would happen when waiting for the query result directly. The drawback of this approach is that some slight popping can occur when an object that was hidden in the previous frame becomes visible in the current frame. The implementation uses the depth buffer to check for occlusion of objects, so occlusion culling is only working if the rendering pass has proper scene depth information.

Horde3D supports multiple occlusion sets for different cameras. Enabling occlusion culling for a camera is basically very simple and works by setting a Camera node parameter. But in order that occlusion culling works efficiently, the scene needs to be sorted in front-to-back order. In Horde3D this sorting can be achieved through a special parameter in the pipeline drawing commands.

All renderable objects act automatically as occluders. Occludees (objects that can be culled because of occlusion) are currently models and particle emitters. Meshes of a model can occlude other models but a single mesh cannot occlude a mesh of the same Model node. With forward lighting, light sources can also be occluded by other geometry which can be very useful in indoor scenes. Occlusion of light sources is currently not supported for deferred shading.


Note that the occlusion of light sources patch is not yet on the svn.


Top
 Profile  
Reply with quote  
 Post subject: Re: occlusion culling
PostPosted: 27.08.2008, 02:24 
Offline

Joined: 08.11.2006, 03:10
Posts: 384
Location: Australia
swiftcoder wrote:
DarkAngel wrote:
This seems to suggest that it is dependent on the order in which the boxes are rendered...
Isn't that how occlusion culling is supposed to work? You need to sort the scene front-to-back before rendering.
I haven't actually used/implemented it before so I'm just guessing ;)
Given the nature of the 1-frame-delay though, I always imagined that you would render the entire scene, then 'render' the occlusion queries using the final depth-buffer - eliminating the any draw-order dependencies.


Top
 Profile  
Reply with quote  
 Post subject: Re: occlusion culling
PostPosted: 27.08.2008, 07:25 
Offline

Joined: 10.04.2008, 09:13
Posts: 86
I've changed the pipeline configuration to this:

Code:
<!-- Forward Shading Pipeline -->
<Pipeline>
   <CommandQueue>
      <Stage id="Geometry" link="globalSettings.material.xml">
         <ClearTarget depthBuf="true" colBuf0="true" />
         
         <DrawGeometry context="AMBIENT" class="~Translucent" order="FRONT_TO_BACK" />
         <DoForwardLightLoop class="~Translucent" order="FRONT_TO_BACK" />
         
         <DrawGeometry context="TRANSLUCENT" class="Translucent" order="FRONT_TO_BACK" />
      </Stage>
      
      <Stage id="Overlays">
         <DrawOverlays context="OVERLAY" />
      </Stage>
   </CommandQueue>
</Pipeline>


But it doesn't seem to have any effect?


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group