Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document occlusion culling classes and settings #57889

Merged
merged 1 commit into from
Feb 10, 2022

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Feb 9, 2022

This salvages the documentation improvements from #50408, on top of adding some new changes.

@Calinou Calinou requested a review from a team as a code owner February 9, 2022 23:26
@Calinou Calinou added this to the 4.0 milestone Feb 9, 2022
@Calinou Calinou force-pushed the doc-occlusion-culling branch from 7ea9fe6 to 5dd006f Compare February 10, 2022 00:20
@akien-mga akien-mga requested a review from JFonS February 10, 2022 07:22
Copy link
Contributor

@JFonS JFonS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, I just added some minor corrections.

</brief_description>
<description>
Occlusion culling can improve rendering performance in closed/semi-open areas by hiding geometry that is occluded by other objects.
The occlusion culling system is mostly static. [OccluderInstance3D]s can be moved or hidden at run-time, but doing so will trigger a background recomputation that can take several frames. It is recommended to only move [OccluderInstance3D]s sporadically (e.g. for procedural generation purposes), rather than doing so every frame.
The occlusion culling system works by rendering the occluders on the CPU in parallel using [url=https://www.embree.org/]Embree[/url], drawing the result to a 160×90 buffer then using this to cull 3D nodes individually. In the 3D editor, you can preview the occlusion culling buffer by choosing [b]Perspective &gt; Debug Advanced... &gt; Occlusion Culling Buffer[/b] in the top-left corner of the 3D viewport.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The occlusion buffer size is not fixed, it depends on the "rendering/occlusion_culling/occlusion_rays_per_thread" project setting (I now see this may not be a very explicit setting name, we could change it). The resolution is chosen so the number of pixels in the occlusion buffer is approximately (rays_per_thread * cpu_physical_threads). This means CPUs with fewer cores will use a lower resolution, in an attempt to keep performance costs more even across devices.

Copy link
Member Author

@Calinou Calinou Feb 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't see a reference to the number of physical CPU cores, only logical CPU cores (which is the default number for ThreadWorkPool):

(Not that I think your statement is incorrect, but I don't remember Godot being able to return the amount of physical CPU cores present on a system. This would be a good feature to add, but it's a topic for a proposal 🙂)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I got physical/logical cores mixed-up :)

doc/classes/OccluderInstance3D.xml Outdated Show resolved Hide resolved
doc/classes/PolygonOccluder3D.xml Outdated Show resolved Hide resolved
@Calinou Calinou force-pushed the doc-occlusion-culling branch from 5dd006f to b960412 Compare February 10, 2022 17:17
@Calinou
Copy link
Member Author

Calinou commented Feb 10, 2022

I added documentation for the rendering/occlusion_culling/bvh_build_quality and rendering/occlusion_culling/occlusion_rays_per_thread project settings 🙂

@Calinou Calinou force-pushed the doc-occlusion-culling branch from b960412 to dee43ea Compare February 10, 2022 17:24
@JFonS JFonS merged commit b2da1a5 into godotengine:master Feb 10, 2022
@Calinou Calinou deleted the doc-occlusion-culling branch February 10, 2022 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants