Incorrect normals or tangents when using custom split normals #48986

Closed
opened 2016-07-31 23:16:25 +02:00 by Trevor Harris · 7 comments

System Information
Operating system and graphics card
Windows 10
NVidia GTX 1080 Founder's Edition
Intel Core i7-4770K
32GB RAM

Blender Version
Broken: 2.77a

Short description of error
I noticed normal/tangent errors in a model file exported with a custom exporter I wrote for a game engine. After much investigation, these errors are reproducible within blender, which leads me to believe there is a problem with the normals/tangents that are generated from using calc_tangents(). Either that, or there is a problem with how auto_smooth uses the normals from the custom set, or the tangents are mismatched. I've narrowed it down as far as I can.
I'd made a post on the blenderartists forums, thinking it was a problem with my python script. You can look there for more details. https://blenderartists.org/forum/showthread.php?403787-Normals-not-being-read-correctly&p=3081617&viewfull=1#post3081617

Exact steps for others to reproduce the error
Based on a (as simple as possible) attached .blend file with minimum amount of steps
normals_bug.blend

  • Confirm normals appear to be correct in viewport. I've packed the baked normal map, but you may need to save it out before it will display properly in the viewport (another bug?).
  • Run the script in the text editor with the medal object selected.
  • Change the mesh's auto smooth setting off then back on to make it update itself.
  • Normal mapping no longer appears correct. When visually comparing the split normals, they appear identical to the correct normals, so either the visualization is incorrect, or the problem isn't with the normals but with the tangent vectors being used.
**System Information** Operating system and graphics card Windows 10 NVidia GTX 1080 Founder's Edition Intel Core i7-4770K 32GB RAM **Blender Version** Broken: 2.77a **Short description of error** I noticed normal/tangent errors in a model file exported with a custom exporter I wrote for a game engine. After much investigation, these errors are reproducible within blender, which leads me to believe there is a problem with the normals/tangents that are generated from using calc_tangents(). Either that, or there is a problem with how auto_smooth uses the normals from the custom set, or the tangents are mismatched. I've narrowed it down as far as I can. I'd made a post on the blenderartists forums, thinking it was a problem with my python script. You can look there for more details. https://blenderartists.org/forum/showthread.php?403787-Normals-not-being-read-correctly&p=3081617&viewfull=1#post3081617 **Exact steps for others to reproduce the error** Based on a (as simple as possible) attached .blend file with minimum amount of steps [normals_bug.blend](https://archive.blender.org/developer/F330681/normals_bug.blend) - Confirm normals appear to be correct in viewport. I've packed the baked normal map, but you may need to save it out before it will display properly in the viewport (another bug?). - Run the script in the text editor with the medal object selected. - Change the mesh's auto smooth setting off then back on to make it update itself. - Normal mapping no longer appears correct. When visually comparing the split normals, they appear identical to the correct normals, so either the visualization is incorrect, or the problem isn't with the normals but with the tangent vectors being used.
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @BeigeAlert

Added subscriber: @BeigeAlert

Added subscriber: @mont29

Added subscriber: @mont29
Bastien Montagne self-assigned this 2016-08-01 20:23:22 +02:00

First of all: PSD files cannot actually be loaded from packed files (they load from a filepath only, not from a chunk of memory, not sure why, probably some OIIO limitation…). Anyway, please avoid reporting several issues in same ticket, it’s harder to tackle.

As for normals and tangent space… My bet would be, re-setting custom normals generates some very small differences in some cases, which is in turn affecting tspace - will have a closer look about it though… :/

First of all: PSD files cannot actually be loaded from packed files (they load from a filepath only, not from a chunk of memory, not sure why, probably some OIIO limitation…). Anyway, please avoid reporting several issues in same ticket, it’s harder to tackle. As for normals and tangent space… My bet would be, re-setting custom normals generates some very small differences in some cases, which is in turn affecting tspace - will have a closer look about it though… :/

OK, so can confirm that normals varies slightly (we are talking about forth decimal of vector components here…), actually they even varies between Edit and Object mode…

However, problem here was that re-setting custom normals was effectively splitting some normals, due to threashold detecting 'same' normals as being too low. Will increase it to a value that works here, and we'll see if it causes any issue otherwise (but doubt it will, new chosen value remains below 0.01°…).

OK, so can confirm that normals varies slightly (we are talking about forth decimal of vector components here…), actually they even varies between Edit and Object mode… However, problem here was that re-setting custom normals was effectively splitting some normals, due to threashold detecting 'same' normals as being too low. Will increase it to a value that works here, and we'll see if it causes any issue otherwise (but doubt it will, new chosen value remains below 0.01°…).

This issue was referenced by 2f5db2e45b

This issue was referenced by 2f5db2e45b7a8af51b15c45bb41f5dcb49ae9d4d

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
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
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
3 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#48986
No description provided.