godotengine / godotengine/godot
`GPUParticlesCollisionSDF3D` only bakes geometry that has its own parent node as ancestor
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
v4.2.2.stable.mono.official [15073afe3]
### System information
Godot v4.2.2.stable.mono - Windows 10.0.22631 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 4080 (NVIDIA; 32.0.15.5599) - AMD Ryzen 9 7950X3D 16-Core Processor (32 Threads)
### Issue description
The documentation of `GPUParticlesCollisionSDF3D` states:
> Any **visible** [MeshInstance3D](https://docs.godotengine.org/en/stable/classes/class_meshinstance3d.html#class-meshinstance3d)s within the [size](https://docs.godotengine.org/en/stable/classes/class_gpuparticlescollisionsdf3d.html#class-gpuparticlescollisionsdf3d-property-size) will be taken into account for baking, regardless of their [GeometryInstance3D.gi_mode](https://docs.godotengine.org/en/stable/classes/class_geometryinstance3d.html#class-geometryinstance3d-property-gi-mode).
However, currently this is not the case. Please regard this video:
https://github.com/user-attachments/assets/c2c55ac5-bc68-4ebb-a1a7-607361619bde
In it, I have a `GPUParticlesCollisionSDF3D` which is in a separate node branch than the actual geometry. When I click the _Bake SDF_ button, I am asked to save the bake texture and then I get a message that no geometry could be found even though there clearly is **visible** geometry within the area of the SDF. Now I move the `GPUParticlesCollisionSDF3D` into the same branch as the geometry so that both the `GPUParticlesCollisionSDF3D` and the geometry have the same parent node . This seemingly works, however there is still no collision happening. The reason for this is issue #60994, so I restart the editor. Now collision works. As a next step I drag the `GPUParticlesCollisionSDF3D` a bit down in the geometry part of the tree and bake again. As a result, only the tilted plane is considered for the SDF while the ground plane which is now above the `GPUParticlesCollisionSDF3D` is no longer considered and has no more collision. Particularly this last problem can lead to very long debug sessions trying to find out why some piece of geometry isn't colliding when other geometry within the SDF area is.
### Steps to reproduce
In the attached example project open `sdf_bake_test.tscn` and repeat the actions from the video.
### Minimal reproduction project (MRP)
[reproducer.zip](https://github.com/user-attachments/files/16557098/reproducer.zip)
Contributor guide
Research direction
Open the attached reproducer project and run the steps from the video using sdf_bake_test.tscn. Compare baking with the GPUParticlesCollisionSDF3D in different scene-tree branches and positions. Done means all visible MeshInstance3D geometry within the SDF size is included consistently, regardless of its ancestor relationship.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics, game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100