Skip to content

Jolt Physics - soft body normals are computed incorrectly #107831

Closed
@simpkins

Description

@simpkins

Tested versions

  • Reproducible in 4.5-beta1 as well as earlier versions

System information

Windows 11

Issue description

JoltSoftBody3D::update_rendering_server() computes vertex normals incorrectly: it iterates through all faces, and sets the normal for each vertex to the face normal. This results in each vertex getting the normal value from one of its attached faces (the last one in the face list). This results in weird and broken shading.

The code should instead be computing the vertex normal by averaging the normal from all associated faces, similar to how GodotSoftBody3D::update_normals_and_centroids() behaves.

Steps to reproduce

Run the default scene in the attached MRP.

Example of output with Jolt's current normal calculation:
Image

Output with fixed normal calculation, similar to the Godot physics engine behavior:
Image

Minimal reproduction project (MRP)

soft_body_shading.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions