Skip to content

SoftBody3D should ignore input mesh LODs by default #108025

Open
@simpkins

Description

@simpkins

Tested versions

  • Reproducible in current master
  • In currently released builds (prior to 6af3aa5) SoftBody3D would completely fail to render meshes with LODs, so this bug didn't matter

System information

Windows 11

Issue description

Prior to #107985 landing, SoftBody3D would fail to render meshes that contained LODs, because the RenderingServer returned bad LOD information for the input mesh.

After that fix landed, SoftBody3D now successfully copies the input mesh's LODs to the new dynamic mesh it creates. However, it's not clear to me that this behavior is desirable.

The default mesh import logic creates LODs by merging "flat" regions of faces, within some pre-defined bend angle limits. The default LODs combine these flat faces into a single flat face even at very near render distances. This works well for normal meshes that are not dynamically modified at runtime. However SoftBody3D will dynamically update vertex positions at runtime, allowing faces to bend and distort. Using the default imported LODs causes the rendered mesh to use a much simpler set of faces, and not render the true shape computed by the soft body physics.

Here is an example showing the difference. Both of these bodies are using the same input mesh, cube that has been subdivided so it has 3x3 faces on each side. The default import logic creates an LOD that has only one face per side. The cube on the left is using the imported LODs, and the cube on the right was modified to skip copying LODs to the dynamic mesh:

soft_body_lods.mp4

(This captured video also includes some fixes to SoftBody3D normal computation to fix mesh shading, as the normal calculation right now is a bit buggy.)

Steps to reproduce

Import a mesh from a .glb file that contains some subdivided flat plans (where adjacent faces share or nearly share a normal). Godot will automatically generate LODs for the mesh. Then attempt to use this mesh with SoftBody3D.

Minimal reproduction project (MRP)

soft_body_lods.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions