Skip to content

Changing CSG node Snap doesn't regenerate mesh #93240

Description

@31

Tested versions

System information

Godot v4.2.2.stable - Windows 10.0.22631 - Vulkan (Forward+)

Issue description

I found this on a build of #91748, but it applies to 4.2.2 as well and the code is the same on tip.

I tried running TextMesh through CSGMesh3D and subtracting it from a box (Text.tscn) as a way to generate situations where CSG meshing might have problems without making a bunch of nodes or making a big mesh of my own. I spotted some bumpy triangles:

image

Changing the Box's Snap from 0.001 to 0.0001 and reloading the scene fixes it:

image

But: should I really need to reload the scene? Or should set_snap include _make_dirty(); like the other methods do?

void CSGShape3D::set_snap(float p_snap) {
snap = p_snap;
}

void CSGShape3D::set_operation(Operation p_operation) {
operation = p_operation;
_make_dirty();
update_gizmos();
}

I can imagine someone seeing this problem, not knowing to reload the scene (or jiggle a node) and thinking that Snap is broken! With the improvements to CSG in #91748, this might interfere with users attempting to try out the feature and make them think it's less capable than it is.


On 4.2.2, 0.001 snap looks worse, and the mesh has holes (a known issue across many scenarios):

image

Changing to 0.0001 snap doesn't look quite as good as #91748, but it is an improvement in this part of the mesh as there are no visible holes:

image

(There are plenty of holes elsewhere in the mesh, but I think that's to be expected.)

Steps to reproduce

  1. Load https://gist.github.com/31/c3c4bace42d4ca550ae6badf0f2b7cf9, or make a CSG scene with problems that need a lower snap value.
  2. Change snap.
  3. See that the generated mesh doesn't change.

Minimal reproduction project (MRP)

Text.tscn: https://gist.github.com/31/c3c4bace42d4ca550ae6badf0f2b7cf9

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions