Discontinuous shading with (continuous) custom or mapped normals #111805

Closed
opened 2023-09-01 21:06:35 +02:00 by Nathan Vasil · 5 comments

System Information
Operating system: Windows-10-10.0.19045-SP0 64 Bits
Graphics card: NVIDIA GeForce GTX 1070/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 536.23

Blender Version
Broken: version: 3.6.2, branch: blender-v3.6-release, commit date: 2023-08-16 16:43, hash: e53e55951e7a
Broken: version: 4.0.0 Alpha, branch: main, commit date: 2023-09-01 13:21, hash: 400f7c22bc98
Broken: version: 2.93.0, branch: master, commit date: 2021-06-02 11:21, hash: rB84da05a8b806
Worked: version: 2.92.0, branch: master, commit date: 2021-02-24 16:25, hash: rB02948a2cab44

Short description of error
When using normals that do not agree with normalized, interpolated vertex normals, shading is discontinuous:

image

This is true regardless of whether the normals are being defined in the shader (left) or from custom normals (right.)

Expected is that continuous normals lead to continuous shading, as we see last worked in 2.92.0:

image

This is the "correct" render: samples are either occluded or flat. Tiny differences in the incoming vector lead to only tiny changes in the reflection vector, and all surfaces are lighted pretty much evenly from the single light vector.

This is true in both Cycles and Eevee, although the issue is less obvious in Cycles. Workbench renders appropriately (for the case of custom normals only, since mapped normals are not supported by Workbench.)

In order to limit complicating factors, I am lighting these renders from a single sun with angle 0, soft shadows disabled, and no world. The problem is not linked to those factors however.

The issue is more apparent where the surface normal differs more strongly from the face normal, but occurs at even small deviation (long before a 90 degree difference, where problems should be expected.) It occurs from arbitrary normals or custom normals (as shown) and also with mapped normals (from a tangent space or object space normal map.) The exact source of the normals doesn't seem to matter-- so long as they're modified, Blender is shading discontinuously.

Exact steps for others to reproduce the error

Make a Suzanne. Give her a material that makes it easy to see normals, like a glossy. Give her custom normals or set or map the normal.

I'm including the file I used to make the broken shot above, in 3.62.

I have no idea how I missed this for so long-- I have been having problems with custom normals, but I chalked them up to things that I was doing wrong and didn't dig deep into the fundamentals. I started investigating this in more detail after somebody asked for help at https://blender.stackexchange.com/questions/300229/specular-reflection-displays-original-faces-of-my-model-despite-defining-an-obje . They were wondering why object space normal mapping wasn't fully overwriting their mesh normals.

**System Information** Operating system: Windows-10-10.0.19045-SP0 64 Bits Graphics card: NVIDIA GeForce GTX 1070/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 536.23 **Blender Version** Broken: version: 3.6.2, branch: blender-v3.6-release, commit date: 2023-08-16 16:43, hash: `e53e55951e7a` Broken: version: 4.0.0 Alpha, branch: main, commit date: 2023-09-01 13:21, hash: `400f7c22bc98` Broken: version: 2.93.0, branch: master, commit date: 2021-06-02 11:21, hash: `rB84da05a8b806` Worked: version: 2.92.0, branch: master, commit date: 2021-02-24 16:25, hash: `rB02948a2cab44` **Short description of error** When using normals that do not agree with normalized, interpolated vertex normals, shading is discontinuous: ![image](/attachments/8edd93a3-adfd-4c50-a4cc-ffb2e5799902) This is true regardless of whether the normals are being defined in the shader (left) or from custom normals (right.) Expected is that continuous normals lead to continuous shading, as we see last worked in 2.92.0: ![image](/attachments/fad7c3ec-a1ad-40e6-b682-4003d09d8a93) This is the "correct" render: samples are either occluded or flat. Tiny differences in the incoming vector lead to only tiny changes in the reflection vector, and all surfaces are lighted pretty much evenly from the single light vector. This is true in both Cycles and Eevee, although the issue is less obvious in Cycles. Workbench renders appropriately (for the case of custom normals only, since mapped normals are not supported by Workbench.) In order to limit complicating factors, I am lighting these renders from a single sun with angle 0, soft shadows disabled, and no world. The problem is not linked to those factors however. The issue is more apparent where the surface normal differs more strongly from the face normal, but occurs at even small deviation (long before a 90 degree difference, where problems should be expected.) It occurs from arbitrary normals or custom normals (as shown) and also with mapped normals (from a tangent space or object space normal map.) The exact source of the normals doesn't seem to matter-- so long as they're modified, Blender is shading discontinuously. **Exact steps for others to reproduce the error** Make a Suzanne. Give her a material that makes it easy to see normals, like a glossy. Give her custom normals or set or map the normal. I'm including the file I used to make the broken shot above, in 3.62. I have no idea how I missed this for so long-- I have been having problems with custom normals, but I chalked them up to things that I was doing wrong and didn't dig deep into the fundamentals. I started investigating this in more detail after somebody asked for help at https://blender.stackexchange.com/questions/300229/specular-reflection-displays-original-faces-of-my-model-despite-defining-an-obje . They were wondering why object space normal mapping wasn't fully overwriting their mesh normals.
Nathan Vasil added the
Priority
Normal
Type
Report
Status
Needs Triage
labels 2023-09-01 21:06:36 +02:00

Hey, thanks for report. I think here is kind mixup of things. The Normal socket is a normal of surface. This mean, that a light are mirrored from this normal. Soo 2.92.0 look incorrect for me in this case. This look like all light are opposite to each normals. But light aren't..

Hey, thanks for report. I think here is kind mixup of things. The Normal socket is a **normal of surface**. This mean, that a light are mirrored from this normal. Soo 2.92.0 look incorrect for me in this case. This look like all light are opposite to each normals. But light aren't..
Iliya Katushenock added the
Interest
EEVEE & Viewport
Interest
Render & Cycles
labels 2023-09-01 21:15:12 +02:00
Author

Hi Iliya, thanks for your response.

In the particular case of the images I showed, all samples have an identical surface normal which is directly opposite to the light vector. This is because I provided either custom normals or shader data that told Blender that the normal should be (world) 1,0,0, and the light vector is (world) -1,0,0. That's why we should expect what we see in 2.92.0: relatively flat shading. The topology of the mesh shouldn't be visible here; the only variable across the samples is the incoming vector, which varies only very slightly (and more importantly, continuously rather than discontinuously; in a manner that doesn't depend whatsoever on mesh topology.)

It's true that without custom normals or normal mapping, the normal is calculated from the mesh. However, custom normals and normal mapping are pretty routine manipulations, which have been supported by Blender for many, many years (is it decades yet?) that divorce them from the positions of the vertices of the mesh. The problem I am describing does not exist in any situation where we use raw normals, only in situations where we use custom normals or normal mapping.

Hi Iliya, thanks for your response. In the particular case of the images I showed, all samples have an identical surface normal which is directly opposite to the light vector. This is because I provided either custom normals or shader data that told Blender that the normal should be (world) 1,0,0, and the light vector is (world) -1,0,0. That's why we should expect what we see in 2.92.0: relatively flat shading. The topology of the mesh shouldn't be visible here; the only variable across the samples is the incoming vector, which varies only very slightly (and more importantly, continuously rather than discontinuously; in a manner that doesn't depend whatsoever on mesh topology.) It's true that without custom normals or normal mapping, the normal is calculated from the mesh. However, custom normals and normal mapping are pretty routine manipulations, which have been supported by Blender for many, many years (is it decades yet?) that divorce them from the positions of the vertices of the mesh. The problem I am describing does not exist in any situation where we use raw normals, only in situations where we use custom normals or normal mapping.

As it turns out, the roughness (which sort of randomizes the normal) considers the actual normal of the geometry and not the one that was connected.

I don't know why this happens. But in fact I imagine that the normal should be "randomized" according to what was connected.

It's curious that both Cycles and Eevee work like this.

With that in mind, this issue looks like a duplicate of:
#88170: Extreme Normal editing causes flat shading

@fclem, can you shed some light here?

As it turns out, the roughness (which sort of randomizes the normal) considers the actual normal of the geometry and not the one that was connected. I don't know why this happens. But in fact I imagine that the normal should be "randomized" according to what was connected. It's curious that both Cycles and Eevee work like this. With that in mind, this issue looks like a duplicate of: #88170: Extreme Normal editing causes flat shading @fclem, can you shed some light here?

Yes it is the same as #88170.

Yes it is the same as #88170.

I will edit #88170 to contain the files and information in this report. Thank you for it.

Please subscribe in #88170 if you want to see further updates

I will edit #88170 to contain the files and information in this report. Thank you for it. Please subscribe in #88170 if you want to see further updates
Blender Bot added
Status
Archived
and removed
Status
Needs Info from Developers
labels 2023-09-04 16:31:39 +02:00
Germano Cavalcante added
Status
Duplicate
and removed
Status
Archived
labels 2023-09-04 16:31:52 +02:00
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
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#111805
No description provided.