Shader: Add Conductor BSDF Node #114958

Open
Alaska wants to merge 14 commits from Alaska/blender:metallic-bsdf into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Member

Add Conductor BSDF Node to the shader editor.

This node is basically the Glossy BSDF, but with different Fresnel
options, and the anisotropy input is interpreted differently to match
the Principled BSDF's interpretation of these inputs.

This node supports F82 and Conductor fresnel options.

  • F82 allows for the replication of Principled BSDF Metallic materials
  • The Conductor fresnel allows users to input n, k values to easily
    recreate real life metals.
    • A "artist friendly" Conductor Fresnel has also been added
      to allow users to work in colors instead of n, k values.

Images:

Node with the 3 fresnel types:

F82 Tint Conductor - Artistic Conductor
F82 Fresnel - Node.png Conductor Artistic - Node.png Conductor Fresnel - Node.png

When using the same settings, the F82 Tint mode will produce the same result as a Metallic Principled BSDF.

F82 Fresnel on Conductor BSDF Metallic Principled BSDF
F82 Conductor - Render.png Metallic Principled - Render.png

Comparing the F82 Tint mode to Conductor - Artistic, the most notable thing is that Conductor - Artistic can't produce as strong of an edge tint as F82 Tint, with many combinations producing no noticable tint (like the example image below). This generally matches the MaterialX setup for a Artistic Conductor.

F82 Fresnel Conductor - Artistic "Fresnel"
F82 Conductor - Render.png Conductor - Artistic "Fresnel" - Render.png

The Conductor mode can reproduce any material that can be created with the Conductor - Artistic mode, and possibly more? This is done by defining the n, k values directly rather than defining colors and turning them into n, k values. The main benefit this offers is that it allows people to take n, k values from real life materials if material accuracy is important. A list containing some n, k values can be found here: https://physicallybased.info/

Copper n, k Gold n, k Chromium n, k
Copper nk - Render.png Gold nk - Artistic "Fresnel" - Render.png Chromium nk - Artistic "Fresnel" - Render.png
Add Conductor BSDF Node to the shader editor. This node is basically the Glossy BSDF, but with different Fresnel options, and the anisotropy input is interpreted differently to match the Principled BSDF's interpretation of these inputs. This node supports F82 and Conductor fresnel options. - F82 allows for the replication of Principled BSDF Metallic materials - The Conductor fresnel allows users to input `n, k` values to easily recreate real life metals. - A "artist friendly" Conductor Fresnel has also been added to allow users to work in colors instead of `n, k` values. --- Images: Node with the 3 fresnel types: |F82 Tint|Conductor - Artistic|Conductor| |-|-|-| |![F82 Fresnel - Node.png](/attachments/863b1bbd-8542-4201-b5f9-5bc0a9b6af92)|![Conductor Artistic - Node.png](/attachments/1bbcb6db-37c7-44f3-a4e8-9594dbefc569)|![Conductor Fresnel - Node.png](/attachments/418ef332-837d-4d30-ab17-288baa71b59c)| When using the same settings, the `F82 Tint` mode will produce the same result as a Metallic Principled BSDF. |F82 Fresnel on Conductor BSDF|Metallic Principled BSDF| |-|-| |![F82 Conductor - Render.png](/attachments/bc91d63f-bb06-42b7-ba00-0622e04374fe)|![Metallic Principled - Render.png](/attachments/9582fd4f-79b5-41b0-a6bd-8bb02a3b9c6c)| Comparing the `F82 Tint` mode to `Conductor - Artistic`, the most notable thing is that `Conductor - Artistic` can't produce as strong of an edge tint as `F82 Tint`, with many combinations producing no noticable tint (like the example image below). This generally matches the MaterialX setup for a Artistic Conductor. |F82 Fresnel|Conductor - Artistic "Fresnel"| |-|-| |![F82 Conductor - Render.png](/attachments/bc91d63f-bb06-42b7-ba00-0622e04374fe)|![Conductor - Artistic "Fresnel" - Render.png](/attachments/64fc665f-9dfd-4a62-894f-76213977ba5b)| The `Conductor` mode can reproduce any material that can be created with the `Conductor - Artistic` mode, and possibly more? This is done by defining the `n, k` values directly rather than defining colors and turning them into `n, k` values. The main benefit this offers is that it allows people to take `n, k` values from real life materials if material accuracy is important. A list containing some `n, k` values can be found here: https://physicallybased.info/ |Copper `n, k`| Gold `n, k`|Chromium `n, k`| |-|-|-| |![Copper nk - Render.png](/attachments/678befa2-e4df-4eda-9511-a89ba539c13f)|![Gold nk - Artistic "Fresnel" - Render.png](/attachments/117481ec-e128-425d-8c94-6634aa97f203)|![Chromium nk - Artistic "Fresnel" - Render.png](/attachments/c14fbf75-696e-49ee-bac4-cef7a5dac792)|
Alaska added the
Module
Render & Cycles
label 2023-11-16 05:24:10 +01:00
Alaska added 6 commits 2023-11-16 05:24:22 +01:00
46bec5539d Intial Implementation of Conductor BSDF
- Node appears in shader editor
- Material renders in EEVEE

TODO: Work on Cycles
5d6f651aef Intial Implementation of Conductor BSDF
- Node appears in shader editor
- Material renders in EEVEE

TODO: Work on Cycles
54c91f8bd3 Intial Cycles support
The material now (incorrectly) renders in Cycles in both SVM and OSL

TODO:
 - Add support for Tint to SVM
 - Use seperate "Conductor BSDF" case instead of reusing glossy closures.
 - Update SVM and OSL to be based on the Principled BSDF Metallic instead of the Glossy BSDF
Alaska requested review from Brecht Van Lommel 2023-11-16 05:24:29 +01:00
Alaska requested review from Lukas Stockner 2023-11-16 05:24:37 +01:00
Author
Member

Intially when I mentioned adding this to Blender, it was going to be called the "Metallic BSDF". But I renamed it to the "Conductor BSDF" in line with MaterialX.

Please let me know if you want the name changed.

Intially when I mentioned adding this to Blender, it was going to be called the "Metallic BSDF". But I renamed it to the "Conductor BSDF" in line with MaterialX. Please let me know if you want the name changed.
First-time contributor

What is the difference between this and Glossy BSDF?

What is the difference between this and Glossy BSDF?
Author
Member

What is the difference between this and Glossy BSDF?

  • The Conductor BSDF has support for the F82 tint like the Principled BSDF.
  • Anisotropy is interpreted differently from the Glossy BSDF.
  • Fewer Microfacet Distributions are supported.
> What is the difference between this and Glossy BSDF? - The Conductor BSDF has support for the F82 tint like the Principled BSDF. - Anisotropy is interpreted differently from the Glossy BSDF. - Fewer Microfacet Distributions are supported.
Member

Generally this is good to have, but I think we should a) support the full range of Microfacet distributions and b) have an enum for switching between F82 Fresnel and the proper conductive Fresnel (which currently is only available through OSL), potentially also the Artist-Friendly Base/Edge Color reparametrization since enough other tools use it and it's quite straightforward to add without a new closure.

Generally this is good to have, but I think we should a) support the full range of Microfacet distributions and b) have an enum for switching between F82 Fresnel and the proper conductive Fresnel (which currently is only available through OSL), potentially also the Artist-Friendly Base/Edge Color reparametrization since enough other tools use it and it's quite straightforward to add without a new closure.
Author
Member

b) have an enum for switching between F82 Fresnel and the proper conductive Fresnel (which currently is only available through OSL)

Is the OSL "proper conductive Fresnel" osl_closure_conductor_bsdf_setup() in /intern/cycles/kernel/osl/closures_setup.h or is it something else?

potentially also the Artist-Friendly Base/Edge Color reparametrization since enough other tools use it and it's quite straightforward to add without a new closure.

Sorry, it's not clear to me what you mean by this. Do you mean add an option to switch between a Base/Edge color input, and a n, k input? For both the F82 Fresnel and the Conductive Fresnel?

> b) have an enum for switching between F82 Fresnel and the proper conductive Fresnel (which currently is only available through OSL) Is the OSL "proper conductive Fresnel" `osl_closure_conductor_bsdf_setup()` in `/intern/cycles/kernel/osl/closures_setup.h` or is it something else? > potentially also the Artist-Friendly Base/Edge Color reparametrization since enough other tools use it and it's quite straightforward to add without a new closure. Sorry, it's not clear to me what you mean by this. Do you mean add an option to switch between a Base/Edge color input, and a `n, k` input? For both the F82 Fresnel and the Conductive Fresnel?
Alaska added 2 commits 2023-11-19 05:06:15 +01:00
Alaska added 3 commits 2023-11-20 12:25:38 +01:00
9b1a441acb Add Conductor Fresnel to Conductor BSDF
Notable changes from previous revision of Conductor BSDF:
 - There are three "Fresnel Types" that can be selected on the node.
   -  Conductor Fresnel - Artistic (Default)
      - Uses `bsdf_microfacet_setup_fresnel_conductor()` in Cycles. Takes a Color `Base` and `Tint` input with automatic code to turn it into `n, k` values (fresnel_conductor uses `n, k` values).
   - F82 Tint Fresnel (Old default)
      - Uses `bsdf_microfacet_setup_fresnel_f82_tint()` in Cycles. Takes a Color "Base" and "Tint" input. This option should match the a metallic Principled BSDF material.
   - Conductor Fresnel
      - Uses `bsdf_microfacet_setup_fresnel_conductor()` in Cycles. Takes in `n, k` values.
- Various functions have been added to support the new `Conductor Fresnel - Artistic`.
   - For example, I've added `conductor_ior_from_color` and `conductor_extinction_from_color` fucntions to get `n, k` values from color `Base` and `Tint` inputs.
     - Formula is taken from the paper `"Artist Friendly Metallic Fresnel", Ole Gulbrandsen, 2014`.
     - These are the same formulas used by MaterialX in the `artistic_ior` node.
- General other changes (E.G. Change names of certain inputs, adjust default values, etc.)

TODO:
1. Fix the MaterialX node setup for when we're using the "Conductor Fresnel Type".
2. Adjust names and the descriptions of inputs to explain things. (Feedback from developers would be appreciated).
3. Check with Cycles developers to see if the names of the newly added functions are alright.
4. Wait for general code review. See if any other changes are wanted.
21ffc1d77d Adjust names of inputs
Add a code comment
Author
Member

I just wanted to add the commit message of one of the recent commits to explain recent changes. Also it includes a list of TODOs that I couldn't figure out. Help on the TODOs would be appreciated.


Notable changes from previous revision of Conductor BSDF:

  • There are three "Fresnel Types" that can be selected on the node.

    • Conductor Fresnel - Artistic (Default)
      • Uses bsdf_microfacet_setup_fresnel_conductor() in Cycles. Takes a Color Base and Tint input making it "artist friendly" compared to the Conductor Fresnel option (see below). Automatic code is run to turn these colors into n, k values for fresnel_conductor (which uses n, k values).
      • EEVEE behaves the same as F82 Tint. This causes rendering differences between EEVEE and Cycles.
    • F82 Tint Fresnel (Old default)
      • Uses bsdf_microfacet_setup_fresnel_f82_tint() in Cycles. Takes a Color "Base" and "Tint" input. This option should match a metallic Principled BSDF material.
    • Conductor Fresnel
      • Uses bsdf_microfacet_setup_fresnel_conductor() in Cycles. Takes n, k values as inputs.
      • EEVEE takes the n, k values and turns them into Base and F82 tint colors and uses them in the F82 tint formula. This causes rendering differences between EEVEE and Cycles.
  • Various functions have been added to support the new Conductor Fresnel - Artistic.

    • For example, I've added conductor_ior_from_color and conductor_extinction_from_color functions to get n, k values from color Base and Tint inputs.
      • Formula is taken from the paper "Artist Friendly Metallic Fresnel", Ole Gulbrandsen, 2014.
      • These are the same formulas used by MaterialX in the artistic_ior node.
  • General other changes (E.G. Change names of certain inputs, adjust default values, etc.)

TODO:

  1. Fix the MaterialX node setup for when we're using the "Conductor Fresnel Type". (I couldn't figure out how to detect which "Fresnel Type" was being used. So I couldn't switch between using colors and using the n, k values in MaterialX. Help would be appreciated)
  2. Adjust names and the descriptions of inputs to explain things. (I don't know what to put in the description for most of these. And the feedback on the names would be appreciated).
  3. Check with developers to see if the names of the newly added functions are alright.
  4. Wait for general code review. See if any other changes are wanted.
I just wanted to add the commit message of one of the recent commits to explain recent changes. Also it includes a list of TODOs that I couldn't figure out. Help on the TODOs would be appreciated. --- Notable changes from previous revision of Conductor BSDF: - There are three "Fresnel Types" that can be selected on the node. - Conductor Fresnel - Artistic (Default) - Uses `bsdf_microfacet_setup_fresnel_conductor()` in Cycles. Takes a Color `Base` and `Tint` input making it "artist friendly" compared to the `Conductor Fresnel` option (see below). Automatic code is run to turn these colors into `n, k` values for `fresnel_conductor` (which uses `n, k` values). - EEVEE behaves the same as F82 Tint. This causes rendering differences between EEVEE and Cycles. - F82 Tint Fresnel (Old default) - Uses `bsdf_microfacet_setup_fresnel_f82_tint()` in Cycles. Takes a Color "Base" and "Tint" input. This option should match a metallic Principled BSDF material. - Conductor Fresnel - Uses `bsdf_microfacet_setup_fresnel_conductor()` in Cycles. Takes `n, k` values as inputs. - EEVEE takes the n, k values and turns them into `Base` and `F82 tint` colors and uses them in the F82 tint formula. This causes rendering differences between EEVEE and Cycles. - Various functions have been added to support the new `Conductor Fresnel - Artistic`. - For example, I've added `conductor_ior_from_color` and `conductor_extinction_from_color` functions to get `n, k` values from color `Base` and `Tint` inputs. - Formula is taken from the paper `"Artist Friendly Metallic Fresnel", Ole Gulbrandsen, 2014`. - These are the same formulas used by MaterialX in the `artistic_ior` node. - General other changes (E.G. Change names of certain inputs, adjust default values, etc.) TODO: 1. Fix the MaterialX node setup for when we're using the "Conductor Fresnel Type". (I couldn't figure out how to detect which "Fresnel Type" was being used. So I couldn't switch between using colors and using the n, k values in MaterialX. Help would be appreciated) 2. Adjust names and the descriptions of inputs to explain things. (I don't know what to put in the description for most of these. And the feedback on the names would be appreciated). 3. Check with developers to see if the names of the newly added functions are alright. 4. Wait for general code review. See if any other changes are wanted.

@LukasStockner, can you review this one?

@LukasStockner, can you review this one?
Alaska added 1 commit 2024-01-11 01:17:09 +01:00
Lukas Stockner self-assigned this 2024-01-22 03:05:27 +01:00
Alaska added 1 commit 2024-02-23 12:18:51 +01:00
Alaska added 1 commit 2024-02-23 12:20:58 +01:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u metallic-bsdf:Alaska-metallic-bsdf
git checkout Alaska-metallic-bsdf
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#114958
No description provided.