diff options
author | Lukas Stockner <lukas.stockner@freenet.de> | 2020-05-14 23:12:29 +0300 |
---|---|---|
committer | Lukas Stockner <lukas.stockner@freenet.de> | 2020-05-15 01:52:57 +0300 |
commit | c880e54a95dd352262f71cb0834e01fdfbdf000c (patch) | |
tree | 09c788518e44ddd1b2d08b50980d3b9bff9fd602 /intern/cycles/render/nodes.cpp | |
parent | 8d918fe0f2c732258855783b273a9b6a6b429ad7 (diff) |
Cycles: Refactor microfacet BSDFs to remove separate anisotropy code
Since the sampling and evaluation functions handle both cases anyways,
there's not really a point for keeping the distinction in the kernel,
so we might as well cut down the number of CLOSURE_BSDF_MICROFACETs a bit.
Differential Revision: https://developer.blender.org/D7736
Diffstat (limited to 'intern/cycles/render/nodes.cpp')
-rw-r--r-- | intern/cycles/render/nodes.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp index 4b4958fe3da..cdcaeb246dd 100644 --- a/intern/cycles/render/nodes.cpp +++ b/intern/cycles/render/nodes.cpp @@ -2166,12 +2166,11 @@ NODE_DEFINE(AnisotropicBsdfNode) SOCKET_IN_FLOAT(surface_mix_weight, "SurfaceMixWeight", 0.0f, SocketType::SVM_INTERNAL); static NodeEnum distribution_enum; - distribution_enum.insert("beckmann", CLOSURE_BSDF_MICROFACET_BECKMANN_ANISO_ID); - distribution_enum.insert("GGX", CLOSURE_BSDF_MICROFACET_GGX_ANISO_ID); - distribution_enum.insert("Multiscatter GGX", CLOSURE_BSDF_MICROFACET_MULTI_GGX_ANISO_ID); - distribution_enum.insert("ashikhmin_shirley", CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ANISO_ID); - SOCKET_ENUM( - distribution, "Distribution", distribution_enum, CLOSURE_BSDF_MICROFACET_GGX_ANISO_ID); + distribution_enum.insert("beckmann", CLOSURE_BSDF_MICROFACET_BECKMANN_ID); + distribution_enum.insert("GGX", CLOSURE_BSDF_MICROFACET_GGX_ID); + distribution_enum.insert("Multiscatter GGX", CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID); + distribution_enum.insert("ashikhmin_shirley", CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID); + SOCKET_ENUM(distribution, "Distribution", distribution_enum, CLOSURE_BSDF_MICROFACET_GGX_ID); SOCKET_IN_VECTOR(tangent, "Tangent", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_TANGENT); @@ -2186,7 +2185,7 @@ NODE_DEFINE(AnisotropicBsdfNode) AnisotropicBsdfNode::AnisotropicBsdfNode() : BsdfNode(node_type) { - closure = CLOSURE_BSDF_MICROFACET_GGX_ANISO_ID; + closure = CLOSURE_BSDF_MICROFACET_GGX_ID; } void AnisotropicBsdfNode::attributes(Shader *shader, AttributeRequestSet *attributes) @@ -2205,7 +2204,7 @@ void AnisotropicBsdfNode::compile(SVMCompiler &compiler) { closure = distribution; - if (closure == CLOSURE_BSDF_MICROFACET_MULTI_GGX_ANISO_ID) + if (closure == CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID) BsdfNode::compile( compiler, input("Roughness"), input("Anisotropy"), input("Rotation"), input("Color")); else @@ -2299,7 +2298,7 @@ void GlossyBsdfNode::compile(SVMCompiler &compiler) if (closure == CLOSURE_BSDF_REFLECTION_ID) BsdfNode::compile(compiler, NULL, NULL); else if (closure == CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID) - BsdfNode::compile(compiler, input("Roughness"), NULL, input("Color")); + BsdfNode::compile(compiler, input("Roughness"), NULL, NULL, input("Color")); else BsdfNode::compile(compiler, input("Roughness"), NULL); } |