Jump to content

Umbra Sucks. Check out our Easy No-Bake Occlusion Culling


Josh

5,927 views

 Share

With the help of @martyj I was able to test out occlusion culling in the new engine. This was a great chance to revisit an existing feature and see how it can be improved. The first thing I found is that determining visibility based on whether a single pixel is visible isn't necessarily a good idea. If small cracks are present in the scene one single pixel peeking through can cause a lot of unnecessary drawing without improving the visual quality. I changed the occlusion culling more to record the number of pixels drawn, instead just using a yes/no boolean value:

glBeginQuery(GL_SAMPLES_PASSED, glquery);

In OpenGL 4.3, a less accurate but faster GL_ANY_SAMPLES_PASSED_CONSERVATIVE (i.e. it might produce false positives) option was added, but this is a step in the wrong direction, in my opinion.

Because our new clustered forward renderer uses a depth pre-pass I was able to implement a wireframe rendering more that works with occlusion culling. Depth data is rendered in the prepass, and the a color wireframe is drawn on top. This allowed me to easily view the occlusion culling results and fine-tune the algorithm to make it perfect. Here are the results:

As you can see, we have pixel-perfect occlusion culling that is completely dynamic and basically zero-cost, because the entire process is performed on the GPU. Awesome!

  • Like 10
 Share

9 Comments


Recommended Comments

That looks really great. But I worry that CPU performance wasn't ever a bottleneck for me in Leadwerks, it was always GPU. So I'm not sure how helpful it is to move other tasks from CPU to GPU.

Link to comment
2 minutes ago, Genebris said:

That looks really great. But I worry that CPU performance wasn't ever a bottleneck for me in Leadwerks, it was always GPU. So I'm not sure how helpful it is to move other tasks from CPU to GPU.

The performance bottleneck was probably the client-side rendering code, which has been pretty much eliminated in the new engine. GPU utilization is now typically 96-99%.

  • Like 1
Link to comment

I forget if it was ever fixed in Leadwerks but will this avoid the issue where models pop back late when you turn around fast?

Link to comment
6 minutes ago, gamecreator said:

I forget if it was ever fixed in Leadwerks but will this avoid the issue where models pop back late when you turn around fast?

That will never been 100% eliminated but the responsiveness is faster now and it can be minimized.

  • Upvote 1
Link to comment
Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...