Eevee: Specular Light: The sepecular light contribution should be limited to samples with a normal pointing toward the camera #81070

Closed
opened 2020-09-23 00:25:37 +02:00 by Michael Möller · 9 comments

System Information
Operating system: Windows-10-10.0.18362-SP0 64 Bits
Graphics card: GeForce RTX 2070 SUPER/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 456.38

Blender Version
Broken: version: 2.91.0 Alpha, branch: master, commit date: 2020-09-22 18:36, hash: 358a8e00bd
Worked: Unknown

Short description of error
Eevee produces render artifacts on the specular light contribution when the normal vector points away from the camera (for example because of active smooth shading). This can be seen as bright (wrong) reflections near the visibility boundary of the geometry. Cycles does not produce these artifacts, there seems to be no specular light contribution on normals facing away from the camera.

Eevee (wrong specular reflection on the left): Eevee.png

Cycles (correct specular reflections): Cycles.png

Exact steps for others to reproduce the error
Load the attached .blend file and render the image with Eeevee (and to compare) with Cycles. To better understand the problem a dark red color has been added (as Emission) to the parts of the geometry with normals pointing away from the camera, and dark green for parts with normals pointing towards the camera. The specular reflections are white. The .blend file also contains a node group "View Clamped Normal" that allows to "correct" the normals (by changing them so they are not pointing away from the camera). This can be connected to the "Normal" input of the BSDF to hide the problem, as a workaround.

eevee-specular.blend

Suggested fix
Attached is a patch file for a suggested fix in blender/draw/engines/eevee/shaders/lights_lib.glsl by adding the check if dot(N, V) > 0.0 before calculating the specular contribution and returning 0.0 otherwise.

0001-Correct-the-specular-light-contribution.patch

Eevee (with the attached patch applied) Eeeve-Patched.png

**System Information** Operating system: Windows-10-10.0.18362-SP0 64 Bits Graphics card: GeForce RTX 2070 SUPER/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 456.38 **Blender Version** Broken: version: 2.91.0 Alpha, branch: master, commit date: 2020-09-22 18:36, hash: `358a8e00bd` Worked: Unknown **Short description of error** Eevee produces render artifacts on the specular light contribution when the normal vector points away from the camera (for example because of active smooth shading). This can be seen as bright (wrong) reflections near the visibility boundary of the geometry. Cycles does not produce these artifacts, there seems to be no specular light contribution on normals facing away from the camera. Eevee (wrong specular reflection on the left): ![Eevee.png](https://archive.blender.org/developer/F8910260/Eevee.png) Cycles (correct specular reflections): ![Cycles.png](https://archive.blender.org/developer/F8910263/Cycles.png) **Exact steps for others to reproduce the error** Load the attached .blend file and render the image with Eeevee (and to compare) with Cycles. To better understand the problem a dark red color has been added (as Emission) to the parts of the geometry with normals pointing away from the camera, and dark green for parts with normals pointing towards the camera. The specular reflections are white. The .blend file also contains a node group "View Clamped Normal" that allows to "correct" the normals (by changing them so they are not pointing away from the camera). This can be connected to the "Normal" input of the BSDF to hide the problem, as a workaround. [eevee-specular.blend](https://archive.blender.org/developer/F8910317/eevee-specular.blend) **Suggested fix** Attached is a patch file for a suggested fix in blender/draw/engines/eevee/shaders/lights_lib.glsl by adding the check if dot(N, V) > 0.0 before calculating the specular contribution and returning 0.0 otherwise. [0001-Correct-the-specular-light-contribution.patch](https://archive.blender.org/developer/F8910318/0001-Correct-the-specular-light-contribution.patch) Eevee (with the attached patch applied) ![Eeeve-Patched.png](https://archive.blender.org/developer/F8910310/Eeeve-Patched.png)

Added subscriber: @mmoeller

Added subscriber: @mmoeller

#85393 was marked as duplicate of this issue

#85393 was marked as duplicate of this issue

Added subscriber: @bent

Added subscriber: @bent

The above image and .blend file is rather synthetic to make the problem visible. A more typical case is shown in the following image:

specular-artifact.png

The bright pixels on the upper left limit of the sphere should not be there. The image can be reproduced with the attached .blend file:

specular-artifact.blend

The .blend file contains a (smooth shaded) icosphere with a principled BSDF shader. Also for this case, the issue is not visible when rendered with Cycles.

The above image and .blend file is rather synthetic to make the problem visible. A more typical case is shown in the following image: ![specular-artifact.png](https://archive.blender.org/developer/F8912550/specular-artifact.png) The bright pixels on the upper left limit of the sphere should not be there. The image can be reproduced with the attached .blend file: [specular-artifact.blend](https://archive.blender.org/developer/F8912555/specular-artifact.blend) The .blend file contains a (smooth shaded) icosphere with a principled BSDF shader. Also for this case, the issue is not visible when rendered with Cycles.

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'

Added subscriber: @YAFU

Added subscriber: @YAFU

This issue was referenced by 1c22b551d0

This issue was referenced by 1c22b551d0c13ad90bdc6145e6fa7db763038523

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Clément Foucault self-assigned this 2021-03-03 15:22:50 +01:00

@fclem , Thanks for the fix, it solves most of the problem. Just to mention just in case, that even with the fix in certain circumstances (it may depend on the amount of geometry of the mesh and the angle of the view) small fireflies/artifacts may still appear at the edges. For example here (it is more noticeable in the final render image)
Eevee_Specular.blend

EDIT:
Now I'm not sure if this is the same problem or if I should open a new report. The fireflies problem occurs even without lamps and without World lighting, when the material has a Principled BSDF shader:
Eevee_Principled BSDF_fireflies.blend

EDIT 2:
Film > Filter Size value changes number of fireflies.

EDIT 3:
Fixed on master, thanks.

@fclem , Thanks for the fix, it solves most of the problem. Just to mention just in case, that even with the fix in certain circumstances (it may depend on the amount of geometry of the mesh and the angle of the view) small fireflies/artifacts may still appear at the edges. For example here (it is more noticeable in the final render image) [Eevee_Specular.blend](https://archive.blender.org/developer/F9906147/Eevee_Specular.blend) EDIT: Now I'm not sure if this is the same problem or if I should open a new report. The fireflies problem occurs even without lamps and without World lighting, when the material has a Principled BSDF shader: [Eevee_Principled BSDF_fireflies.blend](https://archive.blender.org/developer/F9906949/Eevee_Principled_BSDF_fireflies.blend) EDIT 2: Film > Filter Size value changes number of fireflies. EDIT 3: Fixed on master, thanks.
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
6 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#81070
No description provided.