Cycles/EEVEE: Change specular tint in Principled BSDF from float to color #112192

Manually merged
Brecht Van Lommel merged 25 commits from weizhen/blender:principled-specular-tint into main 2023-09-25 19:54:45 +02:00
Member

for more artistic control. Tints the reflection of dielectric materials at normal incidence.

Transmission 0 Transmission 0.5 Transmission 1
Cycles
EEVEE

TODO:

  • probably tint metal (#112551)
  • add an option to color the whole reflection lobe instead of only at normal incidence, probably inside the specular panel
for more artistic control. Tints the reflection of dielectric materials at normal incidence. || Transmission 0 | Transmission 0.5 | Transmission 1 | |-| -------- | -------- | -------- | |Cycles| ![](attachments/4f56c69e-5903-4638-b5f6-d671ddf5b0eb) | ![](attachments/3dd00a7b-eb99-4dd9-8d33-b824559a4010) | ![](attachments/0711fe3d-78d7-4961-9c02-c4910f664d7c) | |EEVEE|![](attachments/9ede7fd4-2f3a-4d61-98af-9f61f9ed72f2)|![](attachments/120276ee-643d-4d27-b1d8-b4e31c9ce7a7)|![](attachments/35f2e06e-0ea4-44a8-94ec-0420569ad823)| TODO: - [ ] probably tint metal (#112551) - [ ] add an option to color the whole reflection lobe instead of only at normal incidence, probably inside the specular panel
Weizhen Huang added the
Module
Render & Cycles
label 2023-09-10 00:14:57 +02:00
Weizhen Huang added 6 commits 2023-09-10 00:15:10 +02:00
9455ff9743 Refactor: Cycles: weight reflection/refraction lobe selection pdf by tint
Now that there are different Fresnel types and the reflectance can be tinted,
it is better to sample based on the tinted instead of the real Fresnel. Also
avoid computing Fresnel multiple times.
1e94c0e96a Use albedo instead of `transmission_color` for `Fss`
makes more sense when `transmission_color` is dark
7fb8834d30 Color `f0` for transmission component
to be consistent with specular
91a50f0aa0 Use square root of the base color for transmission color
because the color is applied both on entrance and exit. Using square
root makes the resulted color closer to the base color.
7f28729e13 Fix: Cycles Principled BSDF specular component wrong IOR when backfacing
is visible when Transmission value is between 0 and 1.
The behaviour is actually not well defined for specular layer when
coming from inside, but this is at least consistent with the
transmission component and also consistent with the current behaviour in
OSL. Could probably save one closure allocation in svm later.
Author
Member

Not sure about 7f28729e13, the transition seems smoother without the change. Probably should fix OSL instead. Already fixed OSL.

~~Not sure about 7f28729e13, the transition seems smoother without the change. Probably should fix OSL instead.~~ Already fixed OSL.
Weizhen Huang added 1 commit 2023-09-12 19:40:29 +02:00
5983eecddc WIP: EEVEE: tint specular reflection in transmission component
TODO:
tint specular component
change EEVEE-next
add multiscatter energy compensation
Weizhen Huang added 1 commit 2023-09-13 23:52:10 +02:00
Weizhen Huang added 3 commits 2023-09-14 12:19:30 +02:00
Weizhen Huang added 3 commits 2023-09-14 14:17:27 +02:00
Weizhen Huang added 1 commit 2023-09-18 14:55:59 +02:00
Weizhen Huang added 1 commit 2023-09-18 15:37:19 +02:00
Weizhen Huang added 2 commits 2023-09-18 16:16:58 +02:00
Weizhen Huang added 1 commit 2023-09-18 16:21:52 +02:00
Weizhen Huang requested review from Brecht Van Lommel 2023-09-18 16:48:36 +02:00
Weizhen Huang added 5 commits 2023-09-19 19:21:15 +02:00
Weizhen Huang changed title from WIP: Cycles: Change specular tint in Principled BSDF from float to color to Cycles/EEVEE: Change specular tint in Principled BSDF from float to color 2023-09-19 19:43:09 +02:00
Author
Member

The pull request is now ready for review, with two TODOs that I probably have no time nor energy to finish. A few comments:

  • The multiscatter saturation logic of glass in EEVEE is copied from Cycles.
  • For glass this actually tints the transmission color too because we use one_spectrum() - F. Is this intended? Should we use reduce_max as we do for layering?
  • The versioning code is largely copied from the subsurface. Despite the effort, I’m unsure about the versioning because it’s actually not backward compatible at all:
    1. For specular component I did not extract the hue and saturation as is previously done, because glass doesn’t extract them, and it is unclear how to handle the case when the material is mixed between the two.
    2. For glass we used to color the whole reflection, but now only the F0 is colored. If we add the enum option to tint the whole reflection we can still make this compatible.
The pull request is now ready for review, with two TODOs that I probably have no time nor energy to finish. A few comments: * The multiscatter saturation logic of glass in EEVEE is copied from Cycles. * For glass this actually tints the transmission color too because we use `one_spectrum() - F`. Is this intended? Should we use `reduce_max` as we do for layering? * The versioning code is largely copied from the subsurface. Despite the effort, I’m unsure about the versioning because it’s actually not backward compatible at all: 1. For specular component I did not extract the hue and saturation as is previously done, because glass doesn’t extract them, and it is unclear how to handle the case when the material is mixed between the two. 2. For glass we used to color the whole reflection, but now only the F0 is colored. If we add the enum option to tint the whole reflection we can still make this compatible.
Weizhen Huang requested review from Lukas Stockner 2023-09-19 19:47:39 +02:00
Weizhen Huang requested review from Clément Foucault 2023-09-19 19:47:46 +02:00
Clément Foucault approved these changes 2023-09-21 20:05:33 +02:00
Clément Foucault left a comment
Member

EEVEE's code make sense.

EEVEE's code make sense.
Member

Really happy to see it, as it will make Blender specular compatible with glTF specular, avoiding a lot of conversion (that are not 100% accurate).
Is it still planned to be merged for 4.0?

Really happy to see it, as it will make Blender specular compatible with glTF specular, avoiding a lot of conversion (that are not 100% accurate). Is it still planned to be merged for 4.0?
Member

For glass this actually tints the transmission color too because we use one_spectrum() - F. Is this intended? Should we use reduce_max as we do for layering?

Yeah, this is a tricky question. For now, I think it's okay to keep it as-is, that's what OpenPBR also does.

The versioning code is largely copied from the subsurface. Despite the effort, I’m unsure about the versioning because it’s actually not backward compatible at all:

It's not perfect, but I think it's good enough. As you said, getting a perfect fit is very tricky.

add an option to color the whole reflection lobe instead of only at normal incidence, probably inside the specular panel

Could be done in the future, for now I think this is okay.

probably tint metal

We can reuse the parameter. It's not perfect (e.g., metallic tint is physically-based, while dielectric tint isn't; and dielectric tint mostly affects normal incidence while metallic tint mostly affects edge incidence), but it's one parameter less and mixed materials are probably not that common. The most common use of the metallic tint will be to accurately model specific real-life metals, in which case Metallic would be 1.0 anyways.

> For glass this actually tints the transmission color too because we use one_spectrum() - F. Is this intended? Should we use reduce_max as we do for layering? Yeah, this is a tricky question. For now, I think it's okay to keep it as-is, that's what OpenPBR also does. > The versioning code is largely copied from the subsurface. Despite the effort, I’m unsure about the versioning because it’s actually not backward compatible at all: It's not perfect, but I think it's good enough. As you said, getting a perfect fit is very tricky. > add an option to color the whole reflection lobe instead of only at normal incidence, probably inside the specular panel Could be done in the future, for now I think this is okay. > probably tint metal We can reuse the parameter. It's not perfect (e.g., metallic tint is physically-based, while dielectric tint isn't; and dielectric tint mostly affects normal incidence while metallic tint mostly affects edge incidence), but it's one parameter less and mixed materials are probably not that common. The most common use of the metallic tint will be to accurately model specific real-life metals, in which case Metallic would be 1.0 anyways.
Lukas Stockner added 1 commit 2023-09-25 02:24:18 +02:00
Lukas Stockner approved these changes 2023-09-25 02:24:48 +02:00
Member

Is it still planned to be merged for 4.0?

Currently yes afaik.

> Is it still planned to be merged for 4.0? Currently yes afaik.
Brecht Van Lommel manually merged commit def9b76207 into main 2023-09-25 19:54:45 +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 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#112192
No description provided.