Skip to content

Conversation

Hossam86
Copy link
Collaborator

Hardware occlusion queries provide a mechanism to determine whether any pixels would be drawn. For instance, it can be used as a visibility filter any pixels would be drawn. for instance, it can be used as a visibility filter

Graphic3d_ViewOcclusionMask : Provides a way to access occlusion test results for every graphical presentation per each defined view of the viewer

OpenGl_OcclusionQuery: Provides an OpenGL implementation for occlusion queries

Graphic3d_RenderingParams: provides way to enable or disable occlusion query

AIS_InteractiveContext : resets the view occlusion mask for newly loaded objects

Each view invalidates its occlusion query results if the camera has changed.

vnboccluded: Adds a new DRAW command to return the number of occluded objects in the view

Hardware occlusion queries provide a mechanism to determine whether any
pixels would be drawn. For instance, it can be used as a visibility filter
any pixels would be drawn. for instance, it can be used as a visibility filter

Graphic3d_ViewOcclusionMask : Provides a way to access occlusion test results
for every graphical presentation per each defined view of the viewer

OpenGl_OcclusionQuery: Provides an OpenGL implementation for occlusion queries

Graphic3d_RenderingParams:  provides way to enable or disable occlusion query

AIS_InteractiveContext : resets the view occlusion mask for newly loaded objects

Each view invalidates its occlusion query results if the camera has changed.

vnboccluded: Adds a new DRAW command to return the number of occluded objects
in the view
@Hossam86
Copy link
Collaborator Author

Demo for Draw Test Command

DRAW.Test.mp4

@Hossam86 Hossam86 self-assigned this Mar 12, 2025
@Hossam86 Hossam86 added the 1. Visualization AIS cases, animation, ray-tracing, viewer integration into external software and etc... label Mar 12, 2025
@Hossam86
Copy link
Collaborator Author

Another test to clarify potential use cases:

In the viewport, I am visualizing two cones positioned one behind the other.
The left console reports the visible pixel count for each object.
At the beginning of the demo, one cone completely occludes the second one, resulting in 0 pixels reported for the occluded cone. In contrast, a finite number of pixels are reported for the visible cone, indicating that one cone is invisible (0 samples) while the other is visible (finite samples).
As I rotate the camera, the previously occluded cone becomes visible on the screen, and the console reports a finite number of pixels for both cones, indicating that both cones are now visible.
Briefly, this is a low-cost query performed by hardware to determine the number of visible pixels for each object. This information can be used for culling purposes to offload invisible objects from memory or simply for visibility queries

occlsuion_pixel_count_test.mp4

@dpasukhi
Copy link
Member

@Hossam86 the occlusion is enabled by default?
Or need special command to enable it?

@Hossam86
Copy link
Collaborator Author

Hossam86 commented Mar 13, 2025

@dpasukhi # Enabling/Disabling Occlusion Query in View Rendering Parameters

By default, the occlusion query is disabled in the initialization of the view. The OcclusionQueryState is initialized with the OcclusionQuery_Off flag:

OcclusionQueryState(OcclusionQuery_Off),

To enable the occlusion query, the developer can modify the rendering parameters of the view as follows:
aView->ChangeRenderingParams().OcclusionQueryState = Graphic3d_RenderingParams::OcclusionQuery_On;
or
aView->ChangeRenderingParams().OcclusionQueryState = Graphic3d_RenderingParams::OcclusionQuery_NoUpdate;

@dpasukhi
Copy link
Member

How it was enabled for the demo?
And the implementation have affect on the performance, what can be a reason?

@Hossam86
Copy link
Collaborator Author

Hossam86 commented Mar 13, 2025

@dpasukhi The Draw test command vnboccluded can enable it through the same flags in the background for testing.

@dpasukhi
Copy link
Member

dpasukhi commented Mar 13, 2025

@Hossam86 please create a patch which by default will enable that feature to test it everywhere. (later will be reverted)
Additionally, current version have affect on the global performance degradation, will need to detect where is a performance leak even when the functionality is disabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. Visualization AIS cases, animation, ray-tracing, viewer integration into external software and etc...
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

2 participants