Skip to content

Commit

Permalink
import normals when tangents are required
Browse files Browse the repository at this point in the history
  • Loading branch information
pfcDorn committed Oct 26, 2023
1 parent 02f8558 commit b707850
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Runtime/Scripts/SceneImporter/ImporterMeshes.cs
Expand Up @@ -159,10 +159,10 @@ protected virtual async Task ConstructDracoMesh(GLTFMesh mesh, int meshIndex, Ca

// TODO: check if normals and tangents are needed
#pragma warning disable 0219
bool needsNormals = _options.ImportNormals != GLTFImporterNormals.None;
bool needsTangents = _options.ImportTangents != GLTFImporterNormals.None;
bool needsTangents = _options.ImportTangents != GLTFImporterNormals.None ;
bool needsNormals = _options.ImportNormals != GLTFImporterNormals.None || needsTangents;
#pragma warning restore 0219

var draco = new DracoMeshLoader();

dracoDecodeResults[i] = await draco.ConvertDracoMeshToUnity(meshDataArray[i], bufferViewData,
Expand Down Expand Up @@ -276,6 +276,8 @@ protected void ApplyImportOptionsOnMesh(Mesh mesh)
mesh.RecalculateNormals();
else if (_options.ImportNormals == GLTFImporterNormals.Import && mesh.normals.Length == 0 && mesh.GetTopology(0) == MeshTopology.Triangles)
mesh.RecalculateNormals();
else if (_options.ImportTangents != GLTFImporterNormals.None && mesh.normals.Length == 0)
mesh.RecalculateNormals();

if (_options.ImportTangents == GLTFImporterNormals.None)
mesh.tangents = new Vector4[0];
Expand Down

0 comments on commit b707850

Please sign in to comment.