[2.2] Performance: visibility mask vs. render queue

Problems building or running the engine, queries about how to use features etc.
Post Reply
m00ggi
Gnoblar
Posts: 12
Joined: Wed Feb 12, 2020 3:16 pm

[2.2] Performance: visibility mask vs. render queue

Post by m00ggi »

Ogre Version: 2.2.4
Operating System: Windows
Render System: OpenGL

Hello,
I was wondering if there is a difference in performance between render queues and visibility masks.
For example, if I have multiple cameras and large (in terms of memory) meshes in the scene and only some of the cameras need to render some of those meshes. Would there be a difference in performance?
I know that visibility masks are meant to do just this and render queues are meant to specify the render order, but I didn't find the location of visibility check in the code and there are enough queues to split like:
1. common opaque
2. only-visible-to-some-camera-meshes
3. sky
4. common transparent
...
I'm using SkyPostprocess (instead of rq 3) and therefore I need to have two render_scene passes in any case.

Thanks in advance!
m00ggi

Edit: I found the visibility test. It's part of frustum culling. So performance impact should be more or less equal to excluding with render queue (?)
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: [2.2] Performance: visibility mask vs. render queue

Post by dark_sylinc »

Yes. There is.

RenderQueues can be skipped in bulk. If there's 1 million items in a RQ which is skipped, we'll skip 1 million items with a few instructions.

Visibility masks however, if 1 million items are masked away, we still have to process each one of them to see if they're masked.

Conversely, toggling visibility masks is just a couple of bitwise operations per item, while changing RQ requires moving memory around between containers for every item. The difference is negligible for toggling a few items, but may be noticeable if done to large amounts too frequently
m00ggi
Gnoblar
Posts: 12
Joined: Wed Feb 12, 2020 3:16 pm

Re: [2.2] Performance: visibility mask vs. render queue

Post by m00ggi »

Thank you for the explanation. Makes totally sense.
If I understand you correctly, the difference lies in the iteration through the elements. In my case, there are only a few items, but they can have many vertices. So the difference should be rather small.
Post Reply