Skip to content

USD Import: normals import issues #17

@kowalskima

Description

@kowalskima

I noticed the following issues when importing USD normals. I've implemented fixes to each of these items in branch usd-importer-T81257-merge.

  • Redundant call to BKE_mesh_calc_edges() after setting face-varying normals was causing incorrect shading.
  • Vertex normals were rendering black. Fixed by invoking normal_float_to_short_v3() to assign the vector, instead of directly assigning components as floats.
  • Empty vertex-varying normals were causing black renders. Now invoking BKE_mesh_calc_normals() when point normals are empty. Since BKE_mesh_calc_normals() requires edges to be defined, moving point normal calculation to follow reading polys.
  • Now handling primvars:normals if specified. Per Pixar UsdGeomPointBased documentation: If 'normals' and 'primvars:normals' are both specified, the latter has precedence. http://graphics.pixar.com/usd/docs/api/class_usd_geom_point_based.html#ac5427209fe38570a75036a3cb7ebb553
  • Uninitialized USDMeshReader::m_isLeftHanded flag was causing the vertex winding orientation to randomly flip, causing incorrect shading and other issues.
  • Orientation was ignored when assigning normals, causing incorrect shading (see attached image showing incorrect rendering of the attached example sphereLeftHandedOrientation.usda).

leftHandedSphereNormalsBug

sphereLeftHandedOrientation.zip

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions