When changing the node type in material, sockets of different node types are reused #105553

Open
opened 2023-03-08 00:59:01 +01:00 by Weizhen Huang · 9 comments
Member

System Information
Operating system: MacOS
Graphics card: Apple M1

Blender Version
Broken: main
Worked: don't know

Short description of error
Shader nodes that have the same input sockets can have different default values.
But if you switch between shader nodes in the material interface, then the default values will first of all be copied from pre-existing socket of a node of a different type. Because of this, default values may not be used and may look strange.

Exact steps for others to reproduce the error
In the default scene, assign Glass BSDF material to the default cube, and check the "Roughness" field. Now assign another material without "Roughness", such as Hair BSDF, then assign Glass BSDF material again and check the "Roughness" field.

**System Information** Operating system: MacOS Graphics card: Apple M1 **Blender Version** Broken: main Worked: don't know **Short description of error** Shader nodes that have the same input sockets can have different default values. But if you switch between shader nodes in the material interface, then the default values will first of all be copied from pre-existing socket of a node of a different type. Because of this, default values may not be used and may look strange. **Exact steps for others to reproduce the error** In the default scene, assign Glass BSDF material to the default cube, and check the "Roughness" field. Now assign another material without "Roughness", such as Hair BSDF, then assign Glass BSDF material again and check the "Roughness" field.
Weizhen Huang added the
Priority
Normal
Status
Needs Triage
Type
Report
labels 2023-03-08 00:59:02 +01:00
Weizhen Huang added this to the Render & Cycles project 2023-03-08 00:59:03 +01:00
Author
Member

This issue is not limited to the name "Roughness". For example Principled BSDF has a field called "Transmission" with a default value of 0. If I write another shader with a "Transmission" field with some other default value, the default value would nevertheless be 0.

This issue is not limited to the name "Roughness". For example Principled BSDF has a field called "Transmission" with a default value of 0. If I write another shader with a "Transmission" field with some other default value, the default value would nevertheless be 0.
Iliya Katushenock added the
Interest
Nodes & Physics
Interest
User Interface
labels 2023-03-08 09:52:33 +01:00

Hi, I'm not sure if this is a bug with complex behavior, given that the default value is specified in the declaration https://projects.blender.org/blender/blender/src/branch/main/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.cc#L53

Hi, I'm not sure if this is a bug with complex behavior, given that the default value is specified in the declaration https://projects.blender.org/blender/blender/src/branch/main/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.cc#L53
Author
Member
That is only the default "Roughness" value for Principled BSDF. Glossy BSDF also has a "Roughness" of 0.5 https://projects.blender.org/blender/blender/src/branch/main/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.cc#L12. Some other BSDFs have different default values, but when loaded they all start with 0.5. https://projects.blender.org/blender/blender/src/branch/main/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.cc#L12 https://projects.blender.org/blender/blender/src/branch/main/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.cc#L12 https://projects.blender.org/blender/blender/src/branch/main/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.cc#L12

I'm not sure if different default values are a bug, although it can be fixed.

I'm not sure if different default values are a bug, although it can be fixed.
Iliya Katushenock added the
Interest
EEVEE & Viewport
Interest
Render & Cycles
labels 2023-03-08 10:08:28 +01:00
Author
Member

I don't think different default values is a bug, it's reasonable for different shaders to have different default values, they shouldn't interfere with each other.

I don't think different default values is a bug, it's reasonable for different shaders to have different default values, they shouldn't interfere with each other.

All finally, I see what you mean.
Still not sure if this is a bug.

All finally, I see what you mean. Still not sure if this is a bug.
Iliya Katushenock removed the
Interest
EEVEE & Viewport
Interest
Render & Cycles
labels 2023-03-08 10:21:30 +01:00
Iliya Katushenock changed title from Wrong default value in shaders to When changing the node type in material, declarations of different node types are reused 2023-03-08 10:23:44 +01:00
Iliya Katushenock modified the project from Render & Cycles to Nodes & Physics 2023-03-08 10:27:02 +01:00
Iliya Katushenock added
Status
Needs Info from Developers
and removed
Status
Needs Triage
labels 2023-03-08 10:27:24 +01:00

This behavior is a consequence of the operation of updating the node declaration for sockets.
The node reuses old sockets, which makes their values in scope and take precedence over the default values.
This works fine for node groups. But it seems that this may be inconsistent for shader nodes?

This behavior is a consequence of the operation of updating the node declaration for sockets. The node reuses old sockets, which makes their values in scope and take precedence over the default values. This works fine for node groups. But it seems that this may be inconsistent for shader nodes?

This mechanism also works for links, so it seems more and more that it's not a bug and don't look weird...

This mechanism also works for links, so it seems more and more that it's not a bug and don't look weird...
Iliya Katushenock changed title from When changing the node type in material, declarations of different node types are reused to When changing the node type in material, sockets of different node types are reused 2023-03-08 10:31:59 +01:00
Author
Member

Ok I see your point now, this is assuming that different nodes with the same input name have the same meaning, so the value can be copied from the previous one. This makes sense sometimes, maybe this is not a bug, but for nodes with the same input name but different meanings this is quite unintuitive.

Ok I see your point now, this is assuming that different nodes with the same input name have the same meaning, so the value can be copied from the previous one. This makes sense sometimes, maybe this is not a bug, but for nodes with the same input name but different meanings this is quite unintuitive.
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 Assignees
2 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#105553
No description provided.