Undefined behaviour in specular_occlusion is visible on Apple M1 #86660

Closed
opened 2021-03-17 12:53:08 +01:00 by Michael · 7 comments

System Information
Operating system: macOS Big Sur
Graphics card: Apple M1

Blender Version
Broken: (example: 2.93alpha, 8936550269, Sun Mar 14 15:10:18 2021 +0100 "EEVEE: Specular Occlusion: Avoid overdarkening on smooth surfaces") until current version
Worked: The versions before

Short description of error
Switching the default defaultcube scene to the matrial view immediately shows the defaultcube in camo pattern of dark shapes.

Exact steps for others to reproduce the error

  1. Use an Apple M1, it is an error that probably doesn't show up on other machines but it is no driver error.
  2. Create new default scene
  3. Switch on material view
  4. Watch camo pattern of dark shapes.
  5. Switch on ambient occlusion
  6. Watch defaultcube in it's usual correct shape.

Long description of error

  1. In the function specular_occlusion (in ambient_occlusion_lib.glsl) visibility_error is defined but not initialized.
  2. occlusion_eval is called and when int(aoSettings) & USE_AO is false (ambient occlusion is off) the function returns leaving
    visibility_error undefined.
  3. Back in specular_occlusion "visibility *= mix(safe_rcp(visibility_error), 1.0, roughness);" visibility_error contains now a wide range of undefined values.

Proposed fix (which works for me): Set visibility_error to zero in the early exit case of occlusion_eval:

diff --git a/source/blender/draw/engines/eevee/shaders/ambient_occlusion_lib.glsl b/source/blender/draw/engines/eevee/shaders/ambient_occlusion_lib.glsl
index dc5c048422b..9836aa49cd0 100644
--- a/source/blender/draw/engines/eevee/shaders/ambient_occlusion_lib.glsl
+++ b/source/blender/draw/engines/eevee/shaders/ambient_occlusion_lib.glsl
@@ -200,6 +200,7 @@ void occlusion_eval(OcclusionData data,
 {
   if ((int(aoSettings) & USE_AO) == 0) {
     visibility = data.custom_occlusion;
+    visibility_error = 0.0;
     bent_normal = N;
     return;
   }
**System Information** Operating system: macOS Big Sur Graphics card: Apple M1 **Blender Version** Broken: (example: 2.93alpha, 8936550269333297f6c083c92c90f11660b22e33, Sun Mar 14 15:10:18 2021 +0100 "EEVEE: Specular Occlusion: Avoid overdarkening on smooth surfaces") until current version Worked: The versions before **Short description of error** Switching the default defaultcube scene to the matrial view immediately shows the defaultcube in camo pattern of dark shapes. **Exact steps for others to reproduce the error** 1) Use an Apple M1, it is an error that probably doesn't show up on other machines but it is no driver error. 1) Create new default scene 2) Switch on material view 3) Watch camo pattern of dark shapes. 4) Switch on ambient occlusion 5) Watch defaultcube in it's usual correct shape. Long description of error 1) In the function specular_occlusion (in ambient_occlusion_lib.glsl) visibility_error is defined but not initialized. 2) occlusion_eval is called and when int(aoSettings) & USE_AO is false (ambient occlusion is off) the function returns leaving visibility_error undefined. 3) Back in specular_occlusion "visibility *= mix(safe_rcp(visibility_error), 1.0, roughness);" visibility_error contains now a wide range of undefined values. Proposed fix (which works for me): Set visibility_error to zero in the early exit case of occlusion_eval: ``` diff --git a/source/blender/draw/engines/eevee/shaders/ambient_occlusion_lib.glsl b/source/blender/draw/engines/eevee/shaders/ambient_occlusion_lib.glsl index dc5c048422b..9836aa49cd0 100644 --- a/source/blender/draw/engines/eevee/shaders/ambient_occlusion_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/ambient_occlusion_lib.glsl @@ -200,6 +200,7 @@ void occlusion_eval(OcclusionData data, { if ((int(aoSettings) & USE_AO) == 0) { visibility = data.custom_occlusion; + visibility_error = 0.0; bent_normal = N; return; } ```
Author

Added subscriber: @michael64

Added subscriber: @michael64
Clément Foucault was assigned by Michael 2021-03-17 12:54:44 +01:00
Member

Added subscribers: @fclem, @EitanSomething

Added subscribers: @fclem, @EitanSomething
Clément Foucault was unassigned by Eitan Traurig 2021-03-17 15:51:55 +01:00
Member

Please do not assign tasks to developers.

Please do not assign tasks to developers.

Added subscriber: @Dec

Added subscriber: @Dec

I'm having a similar issue (#86615) on Intel. Does your issue match the video linked there?

I'm having a similar issue (#86615) on Intel. Does your issue match the video linked there?

This issue was referenced by 9ca67c47a1

This issue was referenced by 9ca67c47a152a24e0740dbedc09a4bfeec2b6d73

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

Changed status from 'Needs Triage' to: 'Resolved'
Clément Foucault self-assigned this 2021-03-20 22:00:23 +01: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
5 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#86660
No description provided.