Custom split normals & sharp edge edge behavior seems incorrect #110611

Open
opened 2023-07-29 16:11:12 +02:00 by Nick-Kallen · 14 comments

System Information
Operating system: Mac
Graphics card:

Blender Version
Broken: 3.6.1
Worked: 3.2

Hi,

I've noticed several changes to Blender custom (split) normal behavior between 3.2 and 3.6, using both the Python API and the user interface. I apologize if none of these are bugs, but some of this behavior seems possibly unintended to me.

First,

mesh.normals_split_custom_set(custom_normals)

Now automatically marks edges as sharp when the normals differ (or differ past a certain threshold?). This behavior is not in 3.2 and I'm not sure if it is correct or desirable. Is it supposed to be impossible to have split normals without (marked) sharp edges?

Second,

If a mesh has split normals around a sharp edge, removing the sharpness attribute on the edge (in the user interface or the api) throws away the split normal data. I'm attaching a picture:

Third,

Merge by distance in 3.2 used to preserve split normals if it joined two faces with distinct corner normals (but vertices within threshold). It now appears to average them or something.

I've attached a picture of issue #2 and a .blend file with before/afters of issue 2 and 3

**System Information** Operating system: Mac Graphics card: **Blender Version** Broken: 3.6.1 Worked: 3.2 Hi, I've noticed several changes to Blender custom (split) normal behavior between 3.2 and 3.6, using both the Python API and the user interface. I apologize if none of these are bugs, but some of this behavior seems possibly unintended to me. First, mesh.normals_split_custom_set(custom_normals) Now automatically marks edges as sharp when the normals differ (or differ past a certain threshold?). This behavior is not in 3.2 and I'm not sure if it is correct or desirable. Is it supposed to be impossible to have split normals without (marked) sharp edges? Second, If a mesh has split normals around a sharp edge, removing the sharpness attribute on the edge (in the user interface or the api) throws away the split normal data. I'm attaching a picture: Third, Merge by distance in 3.2 used to preserve split normals if it joined two faces with distinct corner normals (but vertices within threshold). It now appears to average them or something. I've attached a picture of issue #2 and a .blend file with before/afters of issue 2 and 3
Nick-Kallen added the
Type
Report
Priority
Normal
Status
Needs Triage
labels 2023-07-29 16:11:13 +02:00
YimingWu added the
Interest
Modeling
label 2023-07-30 10:19:41 +02:00
Member

Hi, thanks for the report. Could you share raw file (with attributes)
It is recommended to split issues in individual reports.
Also: detailed steps for replicating the bug will reduce the investigation time.
A guideline for making a good bug report can be found at https://wiki.blender.org/wiki/Process/Bug_Reports

Hi, thanks for the report. Could you share raw file (with attributes) It is recommended to split issues in individual reports. Also: detailed steps for replicating the bug will reduce the investigation time. A guideline for making a good bug report can be found at https://wiki.blender.org/wiki/Process/Bug_Reports
Pratik Borhade added
Status
Needs Information from User
and removed
Status
Needs Triage
labels 2023-07-31 07:28:20 +02:00
Author

Hi,

I will try my best to provide a good bug report. I'm reporting a difference in behavior using 3.5.1 and 3.6.1. I discovered this while using the API. The exact same code/ addon produced the mesh (mesh-works.blend) in 3.5 and (mesh-doesn't-work) in 3.6.1

  1. Open the attached file.
  2. "Solid 2" should be in edit mode and all vertices are selected
  3. Type "m" and select 'merge by distance'. Use default values:
  • 0.0001 m, Leave "unselected" and "sharp edges" unchecked
  1. Note that 350 vertices are removed
  2. Note that one of the files the normals are preserved and in one of the files the normals are not preserved.
Hi, I will try my best to provide a good bug report. I'm reporting a difference in behavior using 3.5.1 and 3.6.1. I discovered this while using the API. The exact same code/ addon produced the mesh (mesh-works.blend) in 3.5 and (mesh-doesn't-work) in 3.6.1 1. Open the attached file. 2. "Solid 2" should be in edit mode and all vertices are selected 3. Type "m" and select 'merge by distance'. Use default values: - 0.0001 m, Leave "unselected" and "sharp edges" unchecked 4. Note that 350 vertices are removed 5. Note that one of the files the normals are preserved and in one of the files the normals are not preserved.
Author

Here is another way of looking at the bug. I'm attaching two files. They are constructed via the same addon, the exact same API functions, in Blender 3.5 and in 3.6

One of them (3.6) has edges marked as sharp automatically, without an explicit API calls to mark sharp edges. It discards split normals at edges not marked sharp, which I believe is incorrect behavior.

Here is another way of looking at the bug. I'm attaching two files. They are constructed via the same addon, the exact same API functions, in Blender 3.5 and in 3.6 One of them (3.6) has edges marked as sharp automatically, without an explicit API calls to mark sharp edges. It discards split normals at edges not marked sharp, which I believe is incorrect behavior.
Author

#109599

This seems like a related issue

https://projects.blender.org/blender/blender/issues/109599 This seems like a related issue
Author

Hi,

Is this still not clear enough as a bug report?

Hi, Is this still not clear enough as a bug report?
Member

Hi, thanks for the info. This indeed looks relevant to (custom normals) #109599, closing.

Hi, thanks for the info. This indeed looks relevant to (custom normals) #109599, closing.
Blender Bot added
Status
Archived
and removed
Status
Needs Information from User
labels 2023-08-03 08:55:55 +02:00
Author

Hi,

Respectfully, I wonder if closing this bug is the right approach. I reviewed Hans' optimization in 3.6 to the way split normals are handled. It is a significant (and worthwhile!) change and possibly (likely?) it introduced several bugs. I want to note that in addition to the OBJ and FBX importer being broken with split normals #109599 , the following behaviors have changed in 3.6 from 3.5:

  1. mesh.normals_split_custom_set() is now marking sharp edges and it wasn't before (probably a bug)
  2. mesh.normals_split_custom_set() is incorrectly marking sharp edges, failing to mark edges that are actually sharp as sharp (definitely a bug)
  3. mesh.normals_split_custom_set() is discarding split normals where edges are not sharp (definitely a bug)
  4. remove_doubles() is averaging normals of merged faces, whereas before it preserved normals of source faces as split normals (probably a bug)

For the things that are "probably" a bug, they are seemingly undocumented changes to behavior between 3.6 and 3.5 (I've reviewed the changelog),they are probably unintended, and at least for my use case they are undesirable.

Thanks

Hi, Respectfully, I wonder if closing this bug is the right approach. I reviewed Hans' optimization in 3.6 to the way split normals are handled. It is a significant (and worthwhile!) change and possibly (likely?) it introduced several bugs. I want to note that in addition to the OBJ and FBX importer being broken with split normals https://projects.blender.org/blender/blender/issues/109599 , the following behaviors have changed in 3.6 from 3.5: 1. mesh.normals_split_custom_set() is now marking sharp edges and it wasn't before (probably a bug) 2. mesh.normals_split_custom_set() is incorrectly marking sharp edges, failing to mark edges that are actually sharp as sharp (definitely a bug) 3. mesh.normals_split_custom_set() is discarding split normals where edges are not sharp (definitely a bug) 4. remove_doubles() is averaging normals of merged faces, whereas before it preserved normals of source faces as split normals (probably a bug) For the things that are "probably" a bug, they are seemingly undocumented changes to behavior between 3.6 and 3.5 (I've reviewed the changelog),they are probably unintended, and at least for my use case they are undesirable. Thanks
Blender Bot added
Status
Needs Triage
and removed
Status
Archived
labels 2023-08-03 12:25:57 +02:00
@HooglyBoogly /^
Member

I believe this report has to be cleaned up in some ways:

  • the comments talk about a difference between 3.5 and 3.6 (whereas the report description has the difference between 3.2 and 3.6)

  • regarding removing the sharp attribute: I cannot spot a difference between any of those versions when doing this from the UI: in all cases, the custom normals are averaged, not preserved

  • regarding merging by distance: I cannot spot a difference between any of those versions when doing this from the UI: in all cases, the custom normals preserved, not averaged

If this is solely about the usage in the python API, please provide a minimal .blend file including a simple script that reproduces those issues (or provide the Addon which reproduces the issue along with exact steps to reproduce this). If this is about the usage in the UI, please also provide more exact steps from blender-split-normal-bug-report.blend for any of the issues.

I believe this report has to be cleaned up in some ways: - the comments talk about a difference between 3.5 and 3.6 (whereas the report description has the difference between 3.2 and 3.6) - regarding removing the sharp attribute: I cannot spot a difference between any of those versions when doing this from the UI: in all cases, the custom normals are averaged, not preserved - regarding merging by distance: I cannot spot a difference between any of those versions when doing this from the UI: in all cases, the custom normals preserved, not averaged If this is solely about the usage in the python API, please provide a minimal .blend file including a simple script that reproduces those issues (or provide the Addon which reproduces the issue along with exact steps to reproduce this). If this is about the usage in the UI, please also provide more exact steps from `blender-split-normal-bug-report.blend` for any of the issues.
Philipp Oeser added
Status
Needs Information from User
and removed
Status
Needs Triage
labels 2023-09-18 16:53:48 +02:00
Member

@Nick-Kallen , can you verify whether this is fixed with #109599 / 7449f0e14caecd70f093aa7c6ba02c5d6d78527e?

@Nick-Kallen , can you verify whether this is fixed with #109599 / 7449f0e14caecd70f093aa7c6ba02c5d6d78527e?
Author

Hi,

I haven't done a thorough evaluation but a quick check in Blender 4.1 alpha, things look quite nice! Blender 3.6 shown by comparison

Hi, I haven't done a thorough evaluation but a quick check in Blender 4.1 alpha, things look quite nice! Blender 3.6 shown by comparison
Author

OK but Unfortunately the behaviour still differs from 3.5. You can see that the API is automatically marking edges as sharp in the pictures posted previously (3.6 and 4.1) but here in screenshot from 3.5 the edges are not marked sharp automatically. To me this change in behaviour is undesirable. This is faceted CAD data, I would like to be able to mark edges sharp myself. Clearing sharp discards split normals, so that isn't an option. I will try to narrow this down to code that you can execute directly. Let me get back to you.

OK but Unfortunately the behaviour still differs from 3.5. You can see that the API is automatically marking edges as sharp in the pictures posted previously (3.6 and 4.1) but here in screenshot from 3.5 the edges are not marked sharp automatically. To me this change in behaviour is undesirable. This is faceted CAD data, I would like to be able to mark edges sharp myself. Clearing sharp discards split normals, so that isn't an option. I will try to narrow this down to code that you can execute directly. Let me get back to you.
Member

Thanks, could you specify importer you've used for that?
Also share information @lichtwerk requested in #110611 (comment)

Thanks, could you specify importer you've used for that? Also share information @lichtwerk requested in https://projects.blender.org/blender/blender/issues/110611#issuecomment-1024898
Author

Hi,

This is not using an importer but using the API. The relevant source code is here:

b1f977c405/handler.py (L128)

To reiterate:
. The behavior is the API not the user interface
. The behavior changed in 3.6. That is, 3.5 and before (... 3.2) seem "correct" to me.

I will try to give you a simple executable test case soon. But to be clear, all you need to do is create an (quad/ngon) object with

 mesh.use_auto_smooth = True
 mesh.normals_split_custom_set(...)

And there are behaviour differences starting with 3.6. (e.g., it is marking sharp where it wasn't before, etc).

Hi, This is not using an importer but using the API. The relevant source code is here: https://github.com/nkallen/plasticity-blender-addon/blob/b1f977c4053724ad67982e73b3dcbb554e4ecab6/handler.py#L128 To reiterate: . The behavior is the API not the user interface . The behavior changed in 3.6. That is, 3.5 and before (... 3.2) seem "correct" to me. I will try to give you a simple executable test case soon. But to be clear, all you need to do is create an (quad/ngon) object with ``` mesh.use_auto_smooth = True mesh.normals_split_custom_set(...) ``` And there are behaviour differences starting with 3.6. (e.g., it is marking sharp where it wasn't before, etc).
Philipp Oeser added
Status
Needs Triage
and removed
Status
Needs Information from User
labels 2023-10-11 12:47:49 +02:00
Iliya Katushenock added the
Interest
Python API
label 2024-04-07 22:21:28 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
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
Asset Browser Project
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
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#110611
No description provided.