CSG is lagging my game

Godot Version

4.1.3

Question

I use CSG to create levels, but it really lags my game (low frames and tons of freeze-frames). I have a pretty decent desktop so that’s not an issue. Can someone explain how why it does that?
I deleted the scene before taking screenshots but the layout looked like this:
Node3D

  • CSGCombiner3D

    • CSGPolygon 1,2,3…

CSG is basically doing procedual meshes all the time. You can not expect good runtime performance from that, especially when your CSG meshes and ops are numberous and/or complex.

CSG is not intended to replace your static mesh geometry in your level and there is a very clear documentation warning about using it like this.

What you are supposed to do with CSG after you are done with the prototype is to convert it to static meshes or export e.g. as gltf scene so you can turn your prototype into your actual level and something that is performance usable.

2 Likes

Is there somewhere i can find info on how to do that?

You can find the CSG documentation that also shows how to export as gltf here Prototyping levels with CSG — Godot Engine (latest) documentation in English

You can also use the get_meshes() function on the main CSG node in a script and save the returned static meshes to a resource with the ResourceSaver to be used with e.g. a MeshInstance3D.

2 Likes