Description
When exporting objects with the Bullet SoftBody trait, the mesh is exported using an optimized format. This causes vertex count to vary depending on whether UV maps are present.
In this case, I chose a simple Ico Sphere with 42 vertices.
The outputs of trace( cast ( objcet ,MeshObject ).data.geom.positions.values.length / 4 ) for different cases:
|Export Type| With UV map| Without UV map|
|-------------| ------------- | ------------- |
|Optimized Export| 63 | 42 |
|Regular Export| 240 | 240 |
This is important because if a SoftBody of 42 vertices is exported with 63 instead, unlike in graphics, Bullet considers it as completely different vertices. This in turn causes the SoftBody to explode into pieces.
The regular export however does not change with the presence of a UV map, hence is not of concern here. Bullet needs vertices in an optimized format.
I narrowed down the points where mesh vertices are processed and exported:
Mesh Export
To Reproduce
Add any closed object with UV map, shade smooth, and apply SoftBody. The Object explodes. If Object does not have a UV map, SoftBody behaves normally
Expected behavior
Regardless of the presence of UV maps, SoftBody must function normally.
System
Blender: 2.83
Armory: v2020.10 ($Id: 7e8f665dca6ab1e34e07ad584b86c36a72bf8d03 $)
OS: Windows 10
Test File
VertexCounts.zip
There is also a bug when you enable Cloth physics to UV mapped objects, it don't explodes but don't work properly.
I think that the Soft body physics was even more broken, because i tried to apply it without shading smooth. Is not better to apply shade smooth automatically when enable the soft/cloth physics to any object in the moment of the export?
@knowledgenude Yes. The issue also exists in Cloth physics. I am working on improving the physics side of Cloth and SoftBody to more resemble that of Blender (Blender does not use BulletPhysics for Cloth and SoftBody).
However, the main challenge I face is to reduce the vertex count to the actual number of verts. This is partially working right now but needs improvements.
As for the shading, there is no issue on the graphics side of the game, that is even if the cloth/ SB is made Smooth/Flat, it does not matter. All Bulletcares about is the exact numbers of vertices, indices, and triangleswithout repetition. This is what I want from the Optimized Export
Most helpful comment
@knowledgenude Yes. The issue also exists in Cloth physics. I am working on improving the physics side of Cloth and SoftBody to more resemble that of Blender (Blender does not use BulletPhysics for Cloth and SoftBody).
However, the main challenge I face is to reduce the vertex count to the actual number of verts. This is partially working right now but needs improvements.
As for the shading, there is no issue on the graphics side of the game, that is even if the cloth/ SB is made Smooth/Flat, it does not matter. All
Bulletcares about is the exact numbers ofvertices,indices, andtriangleswithout repetition. This is what I want from the Optimized Export