diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-05-08 17:23:13 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-05-08 17:23:13 +0400 |
commit | 3e763d7e4dbbc4acb3deb7afb95e936ce950ebb5 (patch) | |
tree | 9e14267999906ae1fd99e27b7b9b9b8ddf87552b /intern | |
parent | 28617bd7106b918bfd40305fdd709f3e73649d9c (diff) |
Fix #35246: cycles has no simple way to combine bump and normal mapping. Now
the Bump node has a Normal input, so you can chain it after a Normal Map node.
Note that normal mapping always has to be done first because it is tied to the
particular mesh surface and tangents.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/kernel/shaders/node_bump.osl | 4 | ||||
-rw-r--r-- | intern/cycles/render/graph.cpp | 2 | ||||
-rw-r--r-- | intern/cycles/render/nodes.cpp | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/intern/cycles/kernel/shaders/node_bump.osl b/intern/cycles/kernel/shaders/node_bump.osl index 24db1b24458..27770beb776 100644 --- a/intern/cycles/kernel/shaders/node_bump.osl +++ b/intern/cycles/kernel/shaders/node_bump.osl @@ -27,7 +27,7 @@ surface node_bump( float SampleCenter = 0.0, float SampleX = 0.0, float SampleY = 0.0, - output normal Normal = N) + output normal NormalOut = N) { /* get surface tangents from normal */ vector dPdx = Dx(P); @@ -44,6 +44,6 @@ surface node_bump( float absdet = fabs(det); /* compute and output perturbed normal */ - Normal = normalize(absdet * NormalIn - sign(det) * surfgrad); + NormalOut = normalize(absdet * NormalIn - sign(det) * surfgrad); } diff --git a/intern/cycles/render/graph.cpp b/intern/cycles/render/graph.cpp index 50fee15c231..b026f07ce56 100644 --- a/intern/cycles/render/graph.cpp +++ b/intern/cycles/render/graph.cpp @@ -668,7 +668,7 @@ void ShaderGraph::bump_from_displacement() /* for displacement bump, clear the normal input in case the above loop * connected the setnormal out to the bump normalin */ - ShaderInput *bump_normal_in = bump->input("NormalIn"); + ShaderInput *bump_normal_in = bump->input("Normal"); if(bump_normal_in) bump_normal_in->link = NULL; diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp index 983907a1194..d996b108437 100644 --- a/intern/cycles/render/nodes.cpp +++ b/intern/cycles/render/nodes.cpp @@ -3054,7 +3054,7 @@ BumpNode::BumpNode() add_input("SampleCenter", SHADER_SOCKET_FLOAT); add_input("SampleX", SHADER_SOCKET_FLOAT); add_input("SampleY", SHADER_SOCKET_FLOAT); - add_input("NormalIn", SHADER_SOCKET_NORMAL, ShaderInput::NORMAL); + add_input("Normal", SHADER_SOCKET_NORMAL, ShaderInput::NORMAL); add_input("Strength", SHADER_SOCKET_FLOAT, 0.1f); add_output("Normal", SHADER_SOCKET_NORMAL); @@ -3065,7 +3065,7 @@ void BumpNode::compile(SVMCompiler& compiler) ShaderInput *center_in = input("SampleCenter"); ShaderInput *dx_in = input("SampleX"); ShaderInput *dy_in = input("SampleY"); - ShaderInput *normal_in = input("NormalIn"); + ShaderInput *normal_in = input("Normal"); ShaderInput *intensity_in = input("Strength"); ShaderOutput *normal_out = output("Normal"); |