Mesh normals handling in Alembic #71246
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
10 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#71246
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
How Blender currently handles normals in the Alembic import/export causes various issues and confusion. Examples of previous issues are #56792 (Alembic doesn't export custom normals correctly), #69182 (Auto-Smooth does not work on Alembic meshes without normals), and #71130 (Alembic split normal export issue). The goal of this design task is to document the current behaviour, describe issues, and propose a new approach.
Current behaviour
Current behaviour on export:
Current behaviour on import:
An Alembic mesh can contain various kinds of normals, but only one at a time. So it only contains loop normals, or vertex normals (or other normals that Blender completely ignores).
Issues with the Current Behaviour
The current behaviour is hard to handle, mostly due to the fairly hidden and unintuitive use of the Auto Smooth checkbox. Furthermore, the handling of absent normals differs between Blender and other software; for example, the Alembic plugin for Maya assumes "no normals" means "smooth shaded", whereas Blender does the opposite.
Exporting normals can also have a significant effect on the file size. Even though Alembic is not aiming to be the smallest file format ever, it's still beneficial when Blender avoids producing overly large files when this can be avoided. I'm assuming that smooth shading is more common than flat shading.
Proposed Behaviour
The proposed behaviour aims to be easier to understand, produce smaller files in general cases, and be more compatible with other DCC suites.
Proposed behaviour on export:
Proposed behaviour on import:
An Alembic mesh can contain various kinds of normals, but only one at a time. So it only contains loop normals, or vertex normals (or other normals that Blender completely ignores).
Changes & Issues
The major changes in behaviour are:
To Be Discusses
Please let me know what you think of this proposal, mostly whether this is indeed as nice as I think it is (I think it's rather splendid) or whether there are downsides that I haven't seen/described yet.
Added subscribers: @dr.sybren, @mont29, @eyecandy, @ajohnson223, @NikoMaisuradze, @Ruben-1
Added subscriber: @FinbarrORiordan
Added subscriber: @lemenicier_julien
Added subscriber: @MichaelHermann
Added subscriber: @MaciejJutrzenka
would it be hard to make blender handle normals like vertex groups? So in the tab where we have normals. we simply choose the set? same like it is with UV.. and other stuff? and we simply have multiple flags where we can.. toggle what normal set is for viewport and what for rendering as defult... and also would be awesome if you could read those in shader useing.. attrbiute node for example.
Added subscriber: @ConradDueck
Yes, that would require much more work in Blender itself, and is beyond the scope of saving Blender meshes (as they are currently) to Alembic.
Added subscriber: @JayrajKharvadi
I would change that point on new import behavior:
… to
The Alembic mesh contains vertex normals → use as custom loop normals, and enble Auto Smooth to have Blender actually use them.
Think you will find some cases where custom normals (e.g. for toon shading effects) have been stored as vertex normals, because no 'hard edge' was desired, but normal directions others than default ones were used. Note that BKE has an API to set custom normals from per-vertex values as well. That’s what FBX is doing at least.
Another alternative:
Change:
The Alembic mesh contains vertex normals → mark mesh as smooth.
To:
The Alembic mesh contains vertex normals → determine if the provided vertex normals are identical to automatically calculated "smooth" mesh normals, and if they are, mark mesh as smooth. Otherwise, use as custom vertex normals, and enble Auto Smooth to have Blender actually use them.
However, this leads me to a question: Does blender have a concept of "custom vertex normals", or must any kind of custom normals be loop normals?
Blender has no concept of custom vertex normals, only loops (aka face corners) ones. Checking for 'equal to auto normals' might be possible, but won't be a cheap process, and not so sure it would be worth is… If you export your normals, even as vnors, then one can expect them to have some importance?
As to whether there's always importance, it's difficult for me to say without having surveyed all of the DCC exporters, but I think your approach is a good one in the near term especially since the comparison method can always be added later without harming backward compatibility if it's found that other many exporters unnecessarily include vertex normals.
FWIW, so far Blender has had the "vertex normals → shade smooth" approach, and I haven't seen any bug report about this behaviour as of yet.
@mont29 How expensive/cheap is your proposed behaviour? If it's relatively cheap (compared to loading loop normals when they are stored in Alembic) I don't see any reason we shouldn't do this. Of course meshes can be deforming, so this process would happen every frame in such a case.
I can probably construct a failing testcase for this, if it's useful.
Reading vnors into custom lnors is about as expensive as reading real lnors.
Ok. Let's just do that then.
Thanks, but with the change @mont29 suggests we won't have that behaviour anyway.
Having a test case where custom loop normals are stored as vertex normals, that would be handy.
I've added an implementation in D6197, but I need an Alembic file to test it. If someone could share with me an Alembic mesh that contains explicit vertex normals + a screenshot so that I can verify that they're loaded correctly, that would be great.
This comment was removed by @FinbarrORiordan
Added subscriber: @DanielBystedt
Hi Sybren!
I did a quick setup in Houdini and exported 2 alembics. One where normals are assigned to vertecies and one on points. There is also a csv spreadsheet with point positions and normals per vertex
customVertexNormalsForSybren.rar
This comment was removed by @FinbarrORiordan
Thanks @DanielBystedt , your files confirmed the code is doing its thing properly.
It's indeed a bit confusing how different applications name things:
@dr.sybren Hmm, I actually thought Alembic kVertexScope == Blender Vertex Normals, rather than kVaryingScope.
Do you know offhand the difference between kVaryingScope and kVertexScope in alembic-world?
edit for reference, here's the Geometry Scope enum from Blender:
a9efabe336/lib/Alembic/AbcGeom/GeometryScope.h (L120)
Both are interpreted by Blender as vertex scope, see
process_normals()
inabc_mesh.cc
: https://developer.blender.org/diffusion/B/browse/master/source/blender/alembic/intern/abc_mesh.cc$902Nope.
I got some clarification on kVaryingScope vs. kVertexScope here:
https://groups.google.com/d/msg/alembic-discussion/m6mVeR90bZY/iBPX6it2AboJ
quote:
Changed status from 'Open' to: 'Resolved'
Thanks @ajohnson223
The changes in this task were implemented in
b0e7a1d4b4
, and as such will be part of Blender 2.82.Thanks again @dr.sybren, I'm sure it's working nicely but i'll put it through its paces soon.