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

Take CSG nodes into account for occluder generation (occlusion culling) #2910

Open
Tracked by #70533
Calinou opened this issue Jun 23, 2021 · 1 comment
Open
Tracked by #70533

Comments

@Calinou
Copy link
Member

Calinou commented Jun 23, 2021

Describe the project you are working on

The Godot editor 🙂

Describe the problem or limitation you are having in your project

The new occlusion culling feature in master has an occluder generation feature, but it doesn't take CSG nodes into account.
cc @JFonS

With the following scene tree, only MeshInstance3D will have an occluder generated for it:

image

If you don't have any MeshInstances inside the OccluderInstance3D node but only CSG nodes, the generation will fail with a "No meshes to bake." message.

Screenshots

Normal view

image

Occlusion culling buffer debug view

image

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Take CSG nodes into account for occluder generation in the editor plugin that handles this.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

The CSG nodes could be converted to meshes for the purpose of occluder generation, but this should be done non-destructively so that you can keep editing your CSG nodes later on.

We may want to see whether we should extend this to other kinds of meshes such as MultiMeshInstances. While MultiMeshInstancees can only be culled as a group, we could allow generating occluders from their geometry.

If this enhancement will not be used often, can it be worked around with a few lines of script?

This may be doable with a script, but it makes sense to have this as a built-in feature given CSG is all about quick iteration times. While rendering performance is not critical when prototyping, many people use CSG in production, especially in simple games that have a low-poly aesthetic.

Is there a reason why this should be core and not an add-on in the asset library?

See above.

@Jitnaught
Copy link

The reason CSGs aren't supported is because their mesh has no index array. Even if you convert a CSG to a MeshInstance3D by setting the MeshInstance3D's mesh to the CSG's mesh, occluders still won't be baked. It is possible to generate an index array by using SurfaceTool.index() though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants