diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-02-21 12:49:55 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-02-21 15:30:29 +0300 |
commit | a97bc1bedf6fa63cbafbc9f004f9a6c8f472ae44 (patch) | |
tree | 7d9995efdd3c5afac27b1ec75f238a1e3f548fa2 /intern/cycles/render/nodes.cpp | |
parent | 3445ff0f93c167020ee81062e9d6877399f358c6 (diff) |
Fix T43755: Wireframe attribute doesn't work with displace
This attribute missed derivatives calculation.
Not totally sure what's the proper approach for algebraic derivative
calculation, so calculating them by definition. This isn't fastest
way to do it in this case and could be replaced with some smarter magic
in the wireframe calculation loop.
At least currently implemented approach is better than nothing.
Diffstat (limited to 'intern/cycles/render/nodes.cpp')
-rw-r--r-- | intern/cycles/render/nodes.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp index fa6ffffd9b4..7a39811cacd 100644 --- a/intern/cycles/render/nodes.cpp +++ b/intern/cycles/render/nodes.cpp @@ -3577,14 +3577,34 @@ void WireframeNode::compile(SVMCompiler& compiler) { ShaderInput *size_in = input("Size"); ShaderOutput *fac_out = output("Fac"); - + NodeBumpOffset bump_offset = NODE_BUMP_OFFSET_CENTER; + if(bump == SHADER_BUMP_DX) { + bump_offset = NODE_BUMP_OFFSET_DX; + } + else if(bump == SHADER_BUMP_DY) { + bump_offset = NODE_BUMP_OFFSET_DY; + } compiler.stack_assign(size_in); compiler.stack_assign(fac_out); - compiler.add_node(NODE_WIREFRAME, size_in->stack_offset, fac_out->stack_offset, use_pixel_size); + compiler.add_node(NODE_WIREFRAME, + size_in->stack_offset, + fac_out->stack_offset, + compiler.encode_uchar4(use_pixel_size, + bump_offset, + 0, 0)); } void WireframeNode::compile(OSLCompiler& compiler) { + if(bump == SHADER_BUMP_DX) { + compiler.parameter("bump_offset", "dx"); + } + else if(bump == SHADER_BUMP_DY) { + compiler.parameter("bump_offset", "dy"); + } + else { + compiler.parameter("bump_offset", "center"); + } compiler.parameter("use_pixel_size", use_pixel_size); compiler.add(this, "node_wireframe"); } |