atteneder / DracoUnity

Draco 3D Data Compression Unity Package
Apache License 2.0
247 stars 40 forks source link

Model flickering in HoloLens #66

Closed camroo29 closed 1 year ago

camroo29 commented 1 year ago

Hi,

I tried to use DracoUnity with MRTK 3. After loading the model, any movement of the HoloLens (especially when you go close to the model) results in the Model flickering. When the HoloLens is close to the model it is mostly vanished. But when I recorded it, I could see the model was visible in the environment.

I am using: Unity 2021.3.4 MRTK 3

I could not figure out what is really causing such an issue. Any idea?

camroo29 commented 1 year ago

Recalculating the bounds has solved this issue

atteneder commented 1 year ago

Two questions remain:

  1. How to fix this for all users?
  2. What performance impact does your solution have?

How exactly did you recalculate the bounds? If you've used Mesh.RecalculateBounds, it might be more efficient to calculate the bounds during decoding.

Are you loading the mesh from .drc files or in context of glTF?

Thanks.

camroo29 commented 1 year ago

I am using .drc files for runtime loading. This is what I did:

        var mesh = new Mesh();
        Mesh.ApplyAndDisposeWritableMeshData(meshDataArray, mesh);

        if (result.calculateNormals)
        {
            mesh.RecalculateNormals();
        }
        if (requireTangents)
        {
            mesh.RecalculateTangents();
        }

        mesh.RecalculateBounds();

        return mesh;

I did not see any impact on the performance.