Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-03-10 18:09:22 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-03-10 20:05:01 +0300
commit7613ffc944ebc133f1f906ea737ab55718434cc4 (patch)
treee2c54a4b971fe955f4c7538db1fc086a997b8702 /intern/cycles/kernel/shaders
parent8a76f8dac3475b1d24956e0d384d65295f15c76a (diff)
Cycles: switch to squared roughness convention for all nodes.
This was already done for the Principled BSDF to be compatible with typical baked roughness maps in PBR workflows.
Diffstat (limited to 'intern/cycles/kernel/shaders')
-rw-r--r--intern/cycles/kernel/shaders/node_anisotropic_bsdf.osl19
-rw-r--r--intern/cycles/kernel/shaders/node_glass_bsdf.osl11
-rw-r--r--intern/cycles/kernel/shaders/node_glossy_bsdf.osl10
-rw-r--r--intern/cycles/kernel/shaders/node_refraction_bsdf.osl5
4 files changed, 25 insertions, 20 deletions
diff --git a/intern/cycles/kernel/shaders/node_anisotropic_bsdf.osl b/intern/cycles/kernel/shaders/node_anisotropic_bsdf.osl
index bef6d7e8809..21e28ece65d 100644
--- a/intern/cycles/kernel/shaders/node_anisotropic_bsdf.osl
+++ b/intern/cycles/kernel/shaders/node_anisotropic_bsdf.osl
@@ -33,27 +33,28 @@ shader node_anisotropic_bsdf(
T = rotate(T, Rotation * M_2PI, point(0.0, 0.0, 0.0), Normal);
/* compute roughness */
- float RoughnessU, RoughnessV;
+ float roughness = Roughness * Roughness;
+ float roughness_u, roughness_v;
float aniso = clamp(Anisotropy, -0.99, 0.99);
if (aniso < 0.0) {
- RoughnessU = Roughness / (1.0 + aniso);
- RoughnessV = Roughness * (1.0 + aniso);
+ roughness_u = roughness / (1.0 + aniso);
+ roughness_v = roughness * (1.0 + aniso);
}
else {
- RoughnessU = Roughness * (1.0 - aniso);
- RoughnessV = Roughness / (1.0 - aniso);
+ roughness_u = roughness * (1.0 - aniso);
+ roughness_v = roughness / (1.0 - aniso);
}
if (distribution == "sharp")
BSDF = Color * reflection(Normal);
else if (distribution == "beckmann")
- BSDF = Color * microfacet_beckmann_aniso(Normal, T, RoughnessU, RoughnessV);
+ BSDF = Color * microfacet_beckmann_aniso(Normal, T, roughness_u, roughness_v);
else if (distribution == "GGX")
- BSDF = Color * microfacet_ggx_aniso(Normal, T, RoughnessU, RoughnessV);
+ BSDF = Color * microfacet_ggx_aniso(Normal, T, roughness_u, roughness_v);
else if (distribution == "Multiscatter GGX")
- BSDF = Color * microfacet_multi_ggx_aniso(Normal, T, RoughnessU, RoughnessV, Color);
+ BSDF = Color * microfacet_multi_ggx_aniso(Normal, T, roughness_u, roughness_v, Color);
else
- BSDF = Color * ashikhmin_shirley(Normal, T, RoughnessU, RoughnessV);
+ BSDF = Color * ashikhmin_shirley(Normal, T, roughness_u, roughness_v);
}
diff --git a/intern/cycles/kernel/shaders/node_glass_bsdf.osl b/intern/cycles/kernel/shaders/node_glass_bsdf.osl
index a9723a8300a..2e713861c58 100644
--- a/intern/cycles/kernel/shaders/node_glass_bsdf.osl
+++ b/intern/cycles/kernel/shaders/node_glass_bsdf.osl
@@ -29,16 +29,17 @@ shader node_glass_bsdf(
float eta = backfacing() ? 1.0 / f : f;
float cosi = dot(I, Normal);
float Fr = fresnel_dielectric_cos(cosi, eta);
+ float roughness = Roughness * Roughness;
if (distribution == "sharp")
BSDF = Color * (Fr * reflection(Normal) + (1.0 - Fr) * refraction(Normal, eta));
else if (distribution == "beckmann")
- BSDF = Color * (Fr * microfacet_beckmann(Normal, Roughness) +
- (1.0 - Fr) * microfacet_beckmann_refraction(Normal, Roughness, eta));
+ BSDF = Color * (Fr * microfacet_beckmann(Normal, roughness) +
+ (1.0 - Fr) * microfacet_beckmann_refraction(Normal, roughness, eta));
else if (distribution == "Multiscatter GGX")
- BSDF = Color * microfacet_multi_ggx_glass(Normal, Roughness, eta, Color);
+ BSDF = Color * microfacet_multi_ggx_glass(Normal, roughness, eta, Color);
else if (distribution == "GGX")
- BSDF = Color * (Fr * microfacet_ggx(Normal, Roughness) +
- (1.0 - Fr) * microfacet_ggx_refraction(Normal, Roughness, eta));
+ BSDF = Color * (Fr * microfacet_ggx(Normal, roughness) +
+ (1.0 - Fr) * microfacet_ggx_refraction(Normal, roughness, eta));
}
diff --git a/intern/cycles/kernel/shaders/node_glossy_bsdf.osl b/intern/cycles/kernel/shaders/node_glossy_bsdf.osl
index f4ea7e7dc6a..7415211b56d 100644
--- a/intern/cycles/kernel/shaders/node_glossy_bsdf.osl
+++ b/intern/cycles/kernel/shaders/node_glossy_bsdf.osl
@@ -24,16 +24,18 @@ shader node_glossy_bsdf(
normal Normal = N,
output closure color BSDF = 0)
{
+ float roughness = Roughness * Roughness;
+
if (distribution == "sharp")
BSDF = Color * reflection(Normal);
else if (distribution == "beckmann")
- BSDF = Color * microfacet_beckmann(Normal, Roughness);
+ BSDF = Color * microfacet_beckmann(Normal, roughness);
else if (distribution == "GGX")
- BSDF = Color * microfacet_ggx(Normal, Roughness);
+ BSDF = Color * microfacet_ggx(Normal, roughness);
else if (distribution == "Multiscatter GGX")
- BSDF = Color * microfacet_multi_ggx(Normal, Roughness, Color);
+ BSDF = Color * microfacet_multi_ggx(Normal, roughness, Color);
else
- BSDF = Color * ashikhmin_shirley(Normal, vector(0, 0, 0), Roughness, Roughness);
+ BSDF = Color * ashikhmin_shirley(Normal, vector(0, 0, 0), roughness, roughness);
}
diff --git a/intern/cycles/kernel/shaders/node_refraction_bsdf.osl b/intern/cycles/kernel/shaders/node_refraction_bsdf.osl
index 828becf1818..eaab7282243 100644
--- a/intern/cycles/kernel/shaders/node_refraction_bsdf.osl
+++ b/intern/cycles/kernel/shaders/node_refraction_bsdf.osl
@@ -26,12 +26,13 @@ shader node_refraction_bsdf(
{
float f = max(IOR, 1e-5);
float eta = backfacing() ? 1.0 / f : f;
+ float roughness = Roughness * Roughness;
if (distribution == "sharp")
BSDF = Color * refraction(Normal, eta);
else if (distribution == "beckmann")
- BSDF = Color * microfacet_beckmann_refraction(Normal, Roughness, eta);
+ BSDF = Color * microfacet_beckmann_refraction(Normal, roughness, eta);
else if (distribution == "GGX")
- BSDF = Color * microfacet_ggx_refraction(Normal, Roughness, eta);
+ BSDF = Color * microfacet_ggx_refraction(Normal, roughness, eta);
}