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:
authorKarsten Schwenk <macnihilist@gmx.net>2014-06-08 14:16:28 +0400
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2014-06-14 15:49:57 +0400
commit8ce1090d4e8160165281be4b0827dbc1ba28dc8a (patch)
treee65ed8a8bcebab84c50da6a286fa845c6a8ae92e /intern/cycles/render
parentf5cb0cf1a50350e32b6fec5056f23a20606c7ea0 (diff)
Cycles: Ashikhmin-Shirley anisotropic BSDF
* Ashikhmin-Shirley anisotropic BSDF was added as closure * Anisotropic BSDF node now has two distributions Reviewers: brecht, dingto Differential Revision: https://developer.blender.org/D549
Diffstat (limited to 'intern/cycles/render')
-rw-r--r--intern/cycles/render/nodes.cpp29
-rw-r--r--intern/cycles/render/nodes.h8
2 files changed, 28 insertions, 9 deletions
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp
index a38de8a5cec..8976f958b58 100644
--- a/intern/cycles/render/nodes.cpp
+++ b/intern/cycles/render/nodes.cpp
@@ -1583,11 +1583,23 @@ void BsdfNode::compile(OSLCompiler& compiler)
assert(0);
}
-/* Ward BSDF Closure */
+/* Anisotropic BSDF Closure */
-WardBsdfNode::WardBsdfNode()
+static ShaderEnum anisotropic_distribution_init()
{
- closure = CLOSURE_BSDF_WARD_ID;
+ ShaderEnum enm;
+
+ enm.insert("Ward", CLOSURE_BSDF_WARD_ID);
+ enm.insert("Ashikhmin-Shirley", CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID);
+
+ return enm;
+}
+
+ShaderEnum AnisotropicBsdfNode::distribution_enum = anisotropic_distribution_init();
+
+AnisotropicBsdfNode::AnisotropicBsdfNode()
+{
+ distribution = ustring("Ward");
add_input("Tangent", SHADER_SOCKET_VECTOR, ShaderInput::TANGENT);
@@ -1596,7 +1608,7 @@ WardBsdfNode::WardBsdfNode()
add_input("Rotation", SHADER_SOCKET_FLOAT, 0.0f);
}
-void WardBsdfNode::attributes(Shader *shader, AttributeRequestSet *attributes)
+void AnisotropicBsdfNode::attributes(Shader *shader, AttributeRequestSet *attributes)
{
if(shader->has_surface) {
ShaderInput *tangent_in = input("Tangent");
@@ -1608,14 +1620,17 @@ void WardBsdfNode::attributes(Shader *shader, AttributeRequestSet *attributes)
ShaderNode::attributes(shader, attributes);
}
-void WardBsdfNode::compile(SVMCompiler& compiler)
+void AnisotropicBsdfNode::compile(SVMCompiler& compiler)
{
+ closure = (ClosureType)distribution_enum[distribution];
+
BsdfNode::compile(compiler, input("Roughness"), input("Anisotropy"), input("Rotation"));
}
-void WardBsdfNode::compile(OSLCompiler& compiler)
+void AnisotropicBsdfNode::compile(OSLCompiler& compiler)
{
- compiler.add(this, "node_ward_bsdf");
+ compiler.parameter("distribution", distribution);
+ compiler.add(this, "node_anisotropic_bsdf");
}
/* Glossy BSDF Closure */
diff --git a/intern/cycles/render/nodes.h b/intern/cycles/render/nodes.h
index cf89bdadaa2..31b6f4e50c4 100644
--- a/intern/cycles/render/nodes.h
+++ b/intern/cycles/render/nodes.h
@@ -218,9 +218,13 @@ public:
bool scattering;
};
-class WardBsdfNode : public BsdfNode {
+class AnisotropicBsdfNode : public BsdfNode {
public:
- SHADER_NODE_CLASS(WardBsdfNode)
+ SHADER_NODE_CLASS(AnisotropicBsdfNode)
+
+ ustring distribution;
+ static ShaderEnum distribution_enum;
+
void attributes(Shader *shader, AttributeRequestSet *attributes);
};