Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bug / Crash  Not work on Android
#7
Hi,

Switching the ObiSkinnedClothRenderer tangent space update to "Copy normals from simulation" circumvents the issue. Will take a look at why transforming tangents does not work in Android, but for the time being this is simple workaround. All other tangent update modes work fine too, only the "Transform normals and tangents" mode results in this issue.

"Transform normals and tangents" should not be needed unless you have hand-authored your mesh tangent space, or have specified per-face normals for hard edges.

Edit: Found the culprit.

Turns out, there's this flag in Unity that I didn't know about:

https://docs.unity3d.com/ScriptReference...1583224178

When enabled, it removes unused mesh data at build time. It's called "Optimize Mesh Data" in the player settings. Unless you're using a shader that makes use of normal maps (which require a tangent space to be defined), Unity will remove all tangent vector information from meshes in your build. Since Obi assumes the mesh will have both normal and tangent data, and Unity does not know that the tangent data is used by Obi, it tries to access a tangents array of length 0 resulting in the above issue. Unity's documentation does warn that if you enable this flag and do any kind of runtime shader/mesh processing, you can get unintended results.

This does not happen in the editor, because data is stripped only in the build.

Simply adding a check in Line 126 of ObiClothRendererBase:

Code:
if (meshVertexIndex < restTangents.Count)
{
    Vector3 tangent = space.MultiplyVector(delta * restTangents[meshVertexIndex]);
    clothTangents[meshVertexIndex] = new Vector4(tangent.x, tangent.y, tangent.z, clothTangents[meshVertexIndex].w);
}

Allows support for enabling stripUnusedMeshComponents.
Reply


Messages In This Thread
Not work on Android - by Denis - 28-02-2020, 12:42 PM
RE: Not work on Android - by jabi11 - 28-02-2020, 09:19 PM
RE: Not work on Android - by josemendez - 02-03-2020, 08:23 AM
RE: Not work on Android - by Denis - 02-03-2020, 12:57 PM
RE: Not work on Android - by josemendez - 02-03-2020, 01:11 PM
RE: Not work on Android - by Denis - 03-03-2020, 10:48 AM
RE: Not work on Android - by josemendez - 03-03-2020, 01:34 PM
RE: Not work on Android - by Denis - 03-03-2020, 02:17 PM