Page MenuHome

Auto-Smooth does not work on Alembic meshes without normals
Closed, ResolvedPublic

Description

System Information
Operating system: Windows-8-6.2.9200-SP0 64 Bits
Graphics card: GeForce GTX 1070/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 388.71

Blender Version
Broken: version: 2.81 (sub 3), branch: master, commit date: 2019-08-25 19:05, hash: rBaf8e8be7b1c8
Worked: (optional)

Short description of error
When importing alembic with varying vertex count, normals on object appear to be always flat, whether reading them from alembic or smoothing them manually (autosmooth)

Exact steps for others to reproduce the error

  1. Import alembic with varying vertex count (see attached abc file, )
  2. Try to smoothing objects normals, disable "face" in alembic modifier and enable autosmooth.
  3. Normals either will be always flat, or will be smoothed only at first frame.

Event Timeline

Philipp Oeser (lichtwerk) lowered the priority of this task from 90 to 80.Aug 27 2019, 12:25 PM

Since rBe9c149d911c2, reading loop normals should be supported.
In your file, normals dont seem to be exported:

AbcEcho for Alembic 1.7.8 (built May 11 2019 13:50:14)
  file written by: Maya 2018 AbcExport v1.0
  using Alembic : Alembic 1.5.8 (built Jul 13 2016 18:28:45)
  written on : Mon Aug 26 19:38:40 2019
  user description : Exported from: D:/work/livingstone/baloon/untitled

  ScalarProperty name=.childBnds;interpretation=box;datatype=float64_t[6];arraysize=6;numsamps=120
  ScalarProperty name=statistics;interpretation=;datatype=string;arraysize=1;numsamps=1
  ScalarProperty name=1.samples;interpretation=;datatype=uint32_t;arraysize=1;numsamps=1
Object name=/pCube1
  CompoundProperty name=.xform;schema=AbcGeom_Xform_v3
Object name=/pCube1/pCubeShape1
  CompoundProperty name=.geom;schema=AbcGeom_PolyMesh_v1
    ScalarProperty name=.selfBnds;interpretation=box;datatype=float64_t[6];arraysize=6;numsamps=120
    ArrayProperty name=P;interpretation=point;datatype=float32_t[3];arraysize=386;numsamps=120
    ArrayProperty name=.faceIndices;interpretation=;datatype=int32_t;arraysize=1536;numsamps=120
    ArrayProperty name=.faceCounts;interpretation=;datatype=int32_t;arraysize=384;numsamps=120
    CompoundProperty name=uv;schema=
      ArrayProperty name=.vals;interpretation=vector;datatype=float32_t[2];arraysize=441;numsamps=120
      ArrayProperty name=.indices;interpretation=;datatype=uint32_t;arraysize=1536;numsamps=120

(there should be an entry like this in there if normals are exported)
ArrayProperty name=N;interpretation=normal;datatype=float32_t[3];arraysize=24;numsamps=50

From quick glance at rBe9c149d911c2 it seems that if normals are not in the .abc, then indeed these will default to flat? (might be reading it wrong though... see below)
@Niko Maisuradze (BlackRainbow): where are you exporting from? Could you try with exporting normals enabled from there?
@Sybren A. Stüvel (sybren): what is the default if we dont have custom normals in the .abc? smooth/flat? no way to 'override'? (I seem to be getting different results here, once with flat like in this report, once with smooth like in

I'm exporting from maya (2018) . I was sure the test file had normal export enabled. Here i tried here with another test alembic with normals and it also is importing as flat shaded, smooth shading has only effect on first frame, after disabling face on modifier.

I tried importing it to earlier version of blender (2.80-4ef09cf937f2-win64) and both the test files and production file i'm working with are importing fine there. Also, reexporting it from there and importing it to latest daily build seems to fix the issue, smooth normals are imported.

@Sybren A. Stüvel (sybren): what is the default if we dont have custom normals in the .abc? smooth/flat?

It calls BKE_mesh_calc_normals() on the mesh, which in turn calls BKE_mesh_calc_normals_poly(). Nobody bothered to add a comment to explain what that code actually does.

no way to 'override'?

Nope.

Apart from importing via Alembic, there have been issues with smooth/flat object shading regarding NVIDIA cards. See T68681. It is plausible that an Alembic import can be successful, but a manifestation of T68681 disrupts the observation of a flat/smooth object setting.

Sybren A. Stüvel (sybren) lowered the priority of this task from 80 to 50.Oct 17 2019, 11:13 AM

@Garry R. Osgood (grosgood) T68681: Hair Dynamics: simulation doesn't work depending on smooth/flat shaded surfaces (and nvidia gpus?) seems to be about hair simulation, which I doubt is connected to this.

I can confirm this issue, though.

Sybren A. Stüvel (sybren) renamed this task from Smooth shading normals do not work on Alembic with varying vertex count. to Auto-Smooth does not work on Alembic meshes without normals.Oct 17 2019, 11:14 AM

The issue was in the handling of normals when the Alembic mesh doesn't contain any normal info. I've made it so that Auto-Smooth works in such a case; disabling it will show flat-shaded geometry.