-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
Fix VoxelGI MultiMesh and CSG mesh baking #81616
Fix VoxelGI MultiMesh and CSG mesh baking #81616
Conversation
How would you recommend I test this? |
I think the MRP projects and their repro steps in the linked issues are a good start. You can also visualize the generated VoxelGI data in the 3D view by selecting Basically before this PR MultiMesh does not create any VoxelGI data when baked and CSG shape Global Illumination Mode is incorrect. After this PR the MultiMeshes should create VoxelGI representation and CSG shape mode should be correct. Also in both cases setting their node GI mode to disabled should also stop creating VoxelGI data for them and setting it to Static or Dynamic should enable it (after baking). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4d396d3
to
cbb39f4
Compare
I kept the I also noticed that Also rebased the PR and tweaked the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
Thanks! |
Cherry-picked for 4.1.4. |
Adds
MultiMeshInstance3D::get_meshes()
so that VoxelGI will collect the non-node geometry from MultiMeshInstance3D. That method is the semi-secret handshake that VoxelGI uses for this, currently GridMap, CSGShape3D and after this PR MultiMeshInstance3D support it. I'm not a big fan of that way of exposing this functionality, it's kind of limited, hard to extend and has to be made public only for this one usecase, but it's currently the supported way.Also fixes a node GI mode check so that disabled, static and dynamic options work correctly. Bug #79987 was caused because this check was missing from one branch when collecting nodes during VoxelGI baking. This meant that CSGShape3D VoxelGI baking was wrong in following ways depending on its GI mode:
The last issue caused #79987 as the CSGShape3D was both baked as static while also considered dynamic, which caused some visual issues.
I also added the
ERR_FAIL_COND_MSG()
transform check toVoxelizer::plot_mesh()
because of #75485. It's pretty easy to accidentally create NAN's and INF's when currently playing around with MultiMesh, this adds a simple validation check and skips the mesh with an error message if the transform is obviously wrong.