Cycles: Add Metallic Tint to Principled BSDF using F82-Tint model #112551

Manually merged
Brecht Van Lommel merged 26 commits from LukasStockner/blender:principled-metallic into main 2023-09-25 19:54:27 +02:00
Member

With the default value, this is backwards-compatible.

One open TODO is accounting for the edge color in the albedo calculation. Fairly straightforward, just needs a new precomputed 2D table.

With the default value, this is backwards-compatible. One open TODO is accounting for the edge color in the albedo calculation. Fairly straightforward, just needs a new precomputed 2D table.
Lukas Stockner requested review from Brecht Van Lommel 2023-09-19 03:20:41 +02:00
Lukas Stockner requested review from Weizhen Huang 2023-09-19 03:20:41 +02:00
Lukas Stockner added this to the Render & Cycles project 2023-09-19 03:20:46 +02:00
Weizhen Huang reviewed 2023-09-19 11:50:55 +02:00
@ -239,0 +248,4 @@
ccl_private FresnelF82Tint *fresnel = (ccl_private FresnelF82Tint *)bsdf->fresnel;
const float mu = saturatef(1.0f - cos_theta_i);
const float mu5 = sqr(sqr(mu)) * mu;
*r_reflectance = mix(fresnel->f0, one_spectrum(), mu5) - fresnel->b * cos_theta_i * mu5 * mu;
Member

We should add a reference to the formula. I guess Fresnel and Schlick is well-known enough so people know how to search for them, but this F82 is not.

We should add a reference to the formula. I guess Fresnel and Schlick is well-known enough so people know how to search for them, but this F82 is not.
weizhen marked this conversation as resolved
@ -31,6 +31,7 @@ void node_bsdf_principled(vec4 base_color,
vec3 subsurface_radius,
float subsurface_ior,
float subsurface_anisotropy,
vec4 metallic_tint,
Member

If this is not implemented yet I would suggest to add a TODO in the metallic block.

If this is not implemented yet I would suggest to add a TODO in the metallic block.
weizhen marked this conversation as resolved
@ -94,32 +94,34 @@ static void node_declare(NodeDeclarationBuilder &b)
/* Panel for Specular settings. */
PanelDeclarationBuilder &spec = b.add_panel("Specular").default_closed(true);
spec.add_input<decl::Color>("Metallic Tint").default_value({1.0f, 1.0f, 1.0f, 1.0f});
Member

Does this metallic tint belong in the specular panel? In my pull request #112192 I was not sure if the specular tint should affect the metal edge color, because I think the metallic tint should go to the metallic panel. I don't think we should put both in the same panel.
But this specular panel is not well-defined anyway, some of the things also affect other components.

Also, we could add a description such as "Tint of metallic reflection at near-grazing incidence".

Does this metallic tint belong in the specular panel? In my pull request #112192 I was not sure if the specular tint should affect the metal edge color, because I think the metallic tint should go to the metallic panel. I don't think we should put both in the same panel. But this specular panel is not well-defined anyway, some of the things also affect other components. Also, we could add a description such as "Tint of metallic reflection at near-grazing incidence".

I think it can be all in the Specular panel (and of course especially if it's a single input). But even if it was a separate input, I can't see a good way to split dielectric and metallic settings into separate panels.

I think it can be all in the Specular panel (and of course especially if it's a single input). But even if it was a separate input, I can't see a good way to split dielectric and metallic settings into separate panels.
brecht marked this conversation as resolved

I think we should have a single Specular Tint input for both dielectric and metallic. The main reason being that it is more compatible with Standard Surface and OpenPBR, if these are different colors we can't export them. We can always add a second socket later if needed but not remove I'm easily. But a single input works quite well for baking textures and game engines where you don't want too many texture maps, so I'm not really expecting the industry standard to change here.

The downside is that these have different meanings, for metal it's more physically based and for dielectric more artistic. But I still think it's a reasonable trade-off.

I think we should have a single Specular Tint input for both dielectric and metallic. The main reason being that it is more compatible with Standard Surface and OpenPBR, if these are different colors we can't export them. We can always add a second socket later if needed but not remove I'm easily. But a single input works quite well for baking textures and game engines where you don't want too many texture maps, so I'm not really expecting the industry standard to change here. The downside is that these have different meanings, for metal it's more physically based and for dielectric more artistic. But I still think it's a reasonable trade-off.
Lukas Stockner force-pushed principled-metallic from ff1d0695b9 to 14eae8df60 2023-09-25 03:41:44 +02:00 Compare
Author
Member

Alright, I rebased this on top of #112192 to reuse the Specular Tint parameter.

I guess we should merge that first and then rebase this branch again.

Alright, I rebased this on top of #112192 to reuse the Specular Tint parameter. I guess we should merge that first and then rebase this branch again.
Weizhen Huang reviewed 2023-09-25 04:07:19 +02:00
@ -239,0 +251,4 @@
ccl_private FresnelF82Tint *fresnel = (ccl_private FresnelF82Tint *)bsdf->fresnel;
const float mu = saturatef(1.0f - cos_theta_i);
const float mu5 = sqr(sqr(mu)) * mu;
const Spectrum F_schlick = mix(fresnel->f0, one_spectrum(), mu5) *r_reflectance = saturate(
Member

Seems to miss a semicolon

Seems to miss a semicolon
brecht marked this conversation as resolved
Brecht Van Lommel manually merged commit 86156566a7 into main 2023-09-25 19:54:27 +02: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 Assignees
3 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#112551
No description provided.