Regression: Imported FBX has wrong vertex normals/sharp edges in 3.6 Beta #108170

Open
opened 2023-05-23 10:33:29 +02:00 by Jan Javůrek · 6 comments

System Information
Operating system: Windows-10-10.0.19044-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 3080 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 528.02

Blender Version
Broken: version: 3.6.0 Alpha, branch: main, commit date: 2023-05-12 23:03, hash: 654cfc06c591
Worked: version: 3.6.0 Alpha, branch: main, commit date: 2023-05-09 04:08, hash: c49a0fa474de

Short description of error
Imported FBX has wrong vertex normals. Same model imported with Blender 3.51 has correct shading.

Exact steps for others to reproduce the error

  1. Created a cube with Shift + A/Mesh/Cube.
  2. Export the cube as FBX with default export settings.
  3. Import the FBX with default import settings and observe deformed shading and assigned sharp edges.
**System Information** Operating system: Windows-10-10.0.19044-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 3080 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 528.02 **Blender Version** Broken: version: 3.6.0 Alpha, branch: main, commit date: 2023-05-12 23:03, hash: `654cfc06c591` Worked: version: 3.6.0 Alpha, branch: main, commit date: 2023-05-09 04:08, hash: `c49a0fa474de` **Short description of error** Imported FBX has wrong vertex normals. Same model imported with Blender 3.51 has correct shading. **Exact steps for others to reproduce the error** 1. Created a cube with Shift + A/Mesh/Cube. 2. Export the cube as FBX with default export settings. 3. Import the FBX with default import settings and observe deformed shading and assigned sharp edges.
Jan Javůrek added the
Priority
Normal
Type
Report
Status
Needs Triage
labels 2023-05-23 10:33:30 +02:00
Iliya Katueshenock changed title from Imported FBX has wrong vertex normals/sharp edges in 3.6 Beta to Regression: Imported FBX has wrong vertex normals/sharp edges in 3.6 Beta 2023-05-23 11:44:52 +02:00
Iliya Katueshenock added
Priority
High
and removed
Priority
Normal
labels 2023-05-23 11:54:56 +02:00
Iliya Katueshenock added this to the 3.6 LTS milestone 2023-05-23 11:55:02 +02:00

I don't think anything changed in FBX code regarding custom normals, so would rather suspect some breakage of API during the Mesh refactors in the area?

I don't think anything changed in FBX code regarding custom normals, so would rather suspect some breakage of API during the Mesh refactors in the area?
Bastien Montagne added
Status
Needs Information from User
and removed
Status
Confirmed
labels 2023-05-23 16:04:12 +02:00

We are missing reproducible case here though, please attach the FBX file.

We are missing reproducible case here though, please attach the FBX file.

We are missing reproducible case here though, please attach the FBX file.

The repro is not working? Here is the Cube.

> We are missing reproducible case here though, please attach the FBX file. The repro is not working? Here is the Cube.
11 KiB

Mesh.normals_split_custom_set appears to not be setting sharp edges correctly. Cube primitive is pretty obvious, but for some it's not very noticeable, like Cone and Icosphere primitives.

I've made a script that should reproduce the issue (I don't quite have the exact Blender versions listed in the issue, only a slightly older 3.6.0a 2023-05-04 6b5b777ca3ea (no issue present) and a newer 3.6.0b 2023-05-18 0f67ac45471d (issue present)).

import bpy

# Run this script with an active mesh object

mesh = bpy.context.object.data

# Setup:
# Clear existing custom split normals
bpy.ops.mesh.customdata_custom_splitnormals_clear()
# No issue appears to occur where either sharp_face or sharp_edge are True.
# Removing the attributes has the same effect as all values being set to False.
if "sharp_edge" in mesh.attributes:
    for se in mesh.attributes["sharp_edge"].data:
        se.value = False
    # mesh.attributes.remove(mesh.attributes["sharp_edge"])
if "sharp_face" in mesh.attributes:
    for sf in mesh.attributes["sharp_face"].data:
        sf.value = False
    # mesh.attributes.remove(mesh.attributes["sharp_face"])

# Get loop normals
# Since we're calculating them rather than taking them from an imported FBX,
# mesh.auto_smooth_angle and mesh.use_auto_smooth affect the calculated split normals.
# Issues only appear to occur where the split normals create sharp edges.
# auto_smooth_angle of zero will ensure calculated split normals result in sharp edges.
mesh.auto_smooth_angle = 0
mesh.use_auto_smooth = True
mesh.calc_normals_split()
loop_normals = [l.normal for l in mesh.loops]

# Set loop normals
mesh.normals_split_custom_set(loop_normals)

The top meshes are duplicates of the below meshes that have then had the script run on them.
image

`Mesh.normals_split_custom_set` appears to not be setting sharp edges correctly. Cube primitive is pretty obvious, but for some it's not very noticeable, like Cone and Icosphere primitives. I've made a script that should reproduce the issue (I don't quite have the exact Blender versions listed in the issue, only a slightly older 3.6.0a 2023-05-04 `6b5b777ca3ea` (no issue present) and a newer 3.6.0b 2023-05-18 `0f67ac45471d` (issue present)). ```py import bpy # Run this script with an active mesh object mesh = bpy.context.object.data # Setup: # Clear existing custom split normals bpy.ops.mesh.customdata_custom_splitnormals_clear() # No issue appears to occur where either sharp_face or sharp_edge are True. # Removing the attributes has the same effect as all values being set to False. if "sharp_edge" in mesh.attributes: for se in mesh.attributes["sharp_edge"].data: se.value = False # mesh.attributes.remove(mesh.attributes["sharp_edge"]) if "sharp_face" in mesh.attributes: for sf in mesh.attributes["sharp_face"].data: sf.value = False # mesh.attributes.remove(mesh.attributes["sharp_face"]) # Get loop normals # Since we're calculating them rather than taking them from an imported FBX, # mesh.auto_smooth_angle and mesh.use_auto_smooth affect the calculated split normals. # Issues only appear to occur where the split normals create sharp edges. # auto_smooth_angle of zero will ensure calculated split normals result in sharp edges. mesh.auto_smooth_angle = 0 mesh.use_auto_smooth = True mesh.calc_normals_split() loop_normals = [l.normal for l in mesh.loops] # Set loop normals mesh.normals_split_custom_set(loop_normals) ``` The top meshes are duplicates of the below meshes that have then had the script run on them. ![image](/attachments/22e72c7d-b685-4c9e-987e-beda3731f046)
501 KiB

We are missing reproducible case here though, please attach the FBX file.

@mont29 I can reproduce in:
Default cube > export fbx > import this fbx > look at this.
So i counted description as enough

Example file is added

> We are missing reproducible case here though, please attach the FBX file. @mont29 I can reproduce in: Default cube > export fbx > import this fbx > look at this. So i counted description as enough _Example file is added_
Iliya Katueshenock added
Status
Confirmed
and removed
Status
Needs Information from User
labels 2023-05-23 21:34:15 +02:00

@Mysteryem thanks, then this is quite obviously an issue with the recent Mesh editing changes.

@Mysteryem thanks, then this is quite obviously an issue with the recent Mesh editing changes.
Sign in to join this conversation.
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
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
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
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
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#108170
There is no content yet.