Shaders: rename Specular to Specular IOR Level in Principled BSDF

To clarify that this is no longer the primary control, but rather
and adjustment on IOR.

Ref #99447
Ref #112552
This commit is contained in:
Brecht Van Lommel
2023-09-25 12:52:13 +02:00
parent 239edb27ad
commit 1d265eed5d
15 changed files with 34 additions and 33 deletions

View File

@@ -14,7 +14,7 @@ shader node_principled_bsdf(string distribution = "multi_ggx",
float SubsurfaceIOR = 1.4,
float SubsurfaceAnisotropy = 0.0,
float Metallic = 0.0,
float Specular = 0.5,
float SpecularIORLevel = 0.5,
color SpecularTint = color(1.0),
float Roughness = 0.5,
float Anisotropic = 0.0,
@@ -56,8 +56,8 @@ shader node_principled_bsdf(string distribution = "multi_ggx",
if (Metallic < 1.0 && Transmission < 1.0) {
float eta = IOR;
float f0 = F0_from_ior(eta);
if (Specular != 0.5) {
f0 *= 2.0 * max(Specular, 0.0);
if (SpecularIORLevel != 0.5) {
f0 *= 2.0 * max(SpecularIORLevel, 0.0);
eta = ior_from_F0(f0);
if (IOR < 1.0) {
eta = 1.0 / eta;

View File

@@ -74,7 +74,7 @@ ccl_device_noinline int svm_node_closure_bsdf(KernelGlobals kg,
switch (type) {
case CLOSURE_BSDF_PRINCIPLED_ID: {
uint specular_offset, roughness_offset, specular_tint_offset, anisotropic_offset,
uint specular_ior_level_offset, roughness_offset, specular_tint_offset, anisotropic_offset,
sheen_offset, sheen_tint_offset, sheen_roughness_offset, coat_offset,
coat_roughness_offset, coat_ior_offset, eta_offset, transmission_offset,
anisotropic_rotation_offset, coat_tint_offset, coat_normal_offset, dummy, alpha_offset,
@@ -83,7 +83,7 @@ ccl_device_noinline int svm_node_closure_bsdf(KernelGlobals kg,
float3 T = stack_load_float3(stack, data_node.y);
svm_unpack_node_uchar4(data_node.z,
&specular_offset,
&specular_ior_level_offset,
&roughness_offset,
&specular_tint_offset,
&anisotropic_offset);
@@ -327,8 +327,8 @@ ccl_device_noinline int svm_node_closure_bsdf(KernelGlobals kg,
/* Apply IOR adjustment */
float eta = ior;
float f0 = F0_from_ior(eta);
if (specular != 0.5f) {
f0 *= 2.0f * specular;
if (specular_ior_level != 0.5f) {
f0 *= 2.0f * specular_ior_level;
eta = ior_from_F0(f0);
if (ior < 1.0f) {
eta = 1.0f / eta;

View File

@@ -2704,7 +2704,7 @@ NODE_DEFINE(PrincipledBsdfNode)
SOCKET_IN_VECTOR(subsurface_radius, "Subsurface Radius", make_float3(0.1f, 0.1f, 0.1f));
SOCKET_IN_FLOAT(subsurface_ior, "Subsurface IOR", 1.4f);
SOCKET_IN_FLOAT(subsurface_anisotropy, "Subsurface Anisotropy", 0.0f);
SOCKET_IN_FLOAT(specular, "Specular", 0.0f);
SOCKET_IN_FLOAT(specular_ior_level, "Specular IOR Level", 0.0f);
SOCKET_IN_FLOAT(roughness, "Roughness", 0.5f);
SOCKET_IN_COLOR(specular_tint, "Specular Tint", one_float3());
SOCKET_IN_FLOAT(anisotropic, "Anisotropic", 0.0f);
@@ -2802,7 +2802,7 @@ void PrincipledBsdfNode::compile(SVMCompiler &compiler)
int normal_offset = compiler.stack_assign_if_linked(input("Normal"));
int coat_normal_offset = compiler.stack_assign_if_linked(input("Coat Normal"));
int tangent_offset = compiler.stack_assign_if_linked(input("Tangent"));
int specular_offset = compiler.stack_assign(input("Specular"));
int specular_ior_level_offset = compiler.stack_assign(input("Specular IOR Level"));
int roughness_offset = compiler.stack_assign(input("Roughness"));
int specular_tint_offset = compiler.stack_assign(input("Specular Tint"));
int anisotropic_offset = compiler.stack_assign(input("Anisotropic"));
@@ -2836,7 +2836,7 @@ void PrincipledBsdfNode::compile(SVMCompiler &compiler)
normal_offset,
tangent_offset,
compiler.encode_uchar4(
specular_offset, roughness_offset, specular_tint_offset, anisotropic_offset),
specular_ior_level_offset, roughness_offset, specular_tint_offset, anisotropic_offset),
compiler.encode_uchar4(sheen_offset, sheen_tint_offset, sheen_roughness_offset));
compiler.add_node(

View File

@@ -525,7 +525,7 @@ class PrincipledBsdfNode : public BsdfBaseNode {
NODE_SOCKET_API(float, subsurface_anisotropy)
NODE_SOCKET_API(float, metallic)
NODE_SOCKET_API(float, subsurface)
NODE_SOCKET_API(float, specular)
NODE_SOCKET_API(float, specular_ior_level)
NODE_SOCKET_API(float, roughness)
NODE_SOCKET_API(float3, specular_tint)
NODE_SOCKET_API(float, anisotropic)