Eevee - material gets darkened when shader is being mixed with itself using 'mix shader' #61704

Closed
opened 2019-02-19 10:54:24 +01:00 by Marcin Twarowski · 11 comments

Windows 10, GTX 1080
Blender 2.80 2019-02-19 00:38 790cb7799d

See attached file. mix_shader_Eeevee_bug.blend

Shader is mixed with itself using 'mix shader' node. It's a simple mix so it should look the same whether it's 0 or 1. In Cycles it works correctly. In Eevee however it gets darkened.

Blender 2019.02.19 - 10.40.27.01.mp4

EDIT: I just noticed, that even when you mix two separate identical shaders there's still a difference in brightness. You can see that in the video in 00:25 on the lower right corner of the box, there's a slight variation in brightness. What is going is the second shader ignores Screen Space Reflections. If you turn SSR off they both look the same.

Windows 10, GTX 1080 Blender 2.80 2019-02-19 00:38 790cb7799dcf See attached file. [mix_shader_Eeevee_bug.blend](https://archive.blender.org/developer/F6657677/mix_shader_Eeevee_bug.blend) Shader is mixed with itself using 'mix shader' node. It's a simple mix so it should look the same whether it's 0 or 1. In Cycles it works correctly. In Eevee however it gets darkened. [Blender 2019.02.19 - 10.40.27.01.mp4](https://archive.blender.org/developer/F6657706/Blender_2019.02.19_-_10.40.27.01.mp4) EDIT: I just noticed, that even when you mix two separate identical shaders there's still a difference in brightness. You can see that in the video in 00:25 on the lower right corner of the box, there's a slight variation in brightness. What is going is the second shader ignores Screen Space Reflections. If you turn SSR off they both look the same.

Added subscriber: @MarcinTwarowski

Added subscriber: @MarcinTwarowski
Clément Foucault was assigned by William Reynish 2019-02-19 12:01:47 +01:00
Member

Added subscriber: @JacquesLucke

Added subscriber: @JacquesLucke
Member
[mix_shader_Eeevee_bug_simplified.blend](https://archive.blender.org/developer/F6658537/mix_shader_Eeevee_bug_simplified.blend)

I just noticed, that even when you mix two separate identical shaders there's still a difference in brightness. You can see that in the video in 00:25 on the lower right corner of the box, there's a slight variation in brightness. EDIT: What is going is the second shader ignores Screen Space Reflections. If you turn SSR off they both look the same.

I just noticed, that even when you mix two separate identical shaders there's still a difference in brightness. You can see that in the video in 00:25 on the lower right corner of the box, there's a slight variation in brightness. EDIT: What is going is the second shader ignores Screen Space Reflections. If you turn SSR off they both look the same.

Added subscriber: @dfelinto

Added subscriber: @dfelinto

The issue is on the ssr_data calculated in bsdf_common_lib.glsl:closure_mix().
Mainly it is mixing the ssr_data of closure 1 with (0,0,0,w) of closure2:

cl.ssr_data·=·mix(cl1.ssr_data.xyzw,·vec4(vec3(0.0),·cl1.ssr_data.w),·fac);·/*·do·not·blend·roughness·*/

The issue is on the `ssr_data` calculated in `bsdf_common_lib.glsl:closure_mix()`. Mainly it is mixing the ssr_data of closure 1 with (0,0,0,w) of closure2: ```cl.ssr_data·=·mix(cl1.ssr_data.xyzw,·vec4(vec3(0.0),·cl1.ssr_data.w),·fac);·/*·do·not·blend·roughness·*/```

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'

Okay, talked to Clément and this is working by design. Although mixing RGB is fine, there is no way to reasonably mix SSR data.

So we are (by design) reducing the specular intensity when using the mix shader node in EEVEE.

I added some comments on 0e7409d466 explaining what is going on.

Okay, talked to Clément and this is working by design. Although mixing RGB is fine, there is no way to reasonably mix SSR data. So we are (by design) reducing the specular intensity when using the mix shader node in EEVEE. I added some comments on 0e7409d466 explaining what is going on.

I don't get it. I can mix base color maps, metallic maps, roughness maps and normal maps using mix RGB nodes and screen space reflection works just fine. Why is mixing shaders any different?

I don't get it. I can mix base color maps, metallic maps, roughness maps and normal maps using mix RGB nodes and screen space reflection works just fine. Why is mixing shaders any different?

@MarcinTwarowski Because when you are mixing shaders you are mixing the result of the lighting calculation (and/or some other internal data for SSR). Sometimes these cannot be mixed because it would break the SSR completely.

This is the difference between mixing inputs of a bsdfs and the outputs.

To better see what I mean, compare mixing 2 glossy shaders with different roughness and just mixing their roughness instead. And when I say mixing, it is with intermediate values (like 0.5), not 1.0 or 0.0.

@MarcinTwarowski Because when you are mixing shaders you are mixing the result of the lighting calculation (and/or some other internal data for SSR). Sometimes these cannot be mixed because it would break the SSR completely. This is the difference between mixing inputs of a bsdfs and the outputs. To better see what I mean, compare mixing 2 glossy shaders with different roughness and just mixing their roughness instead. And when I say mixing, it is with intermediate values (like 0.5), not 1.0 or 0.0.

Yes, I was wrong. Mixing glossy shaders is not the same as mixing roughness. Thank you for clarification.

Yes, I was wrong. Mixing glossy shaders is not the same as mixing roughness. Thank you for clarification.
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#61704
No description provided.