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.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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");
|
||||
|
||||
|
@@ -36,8 +36,9 @@
|
||||
|
||||
/* **************** BUMP ******************** */
|
||||
static bNodeSocketTemplate sh_node_bump_in[] = {
|
||||
{ SOCK_FLOAT, 1, "Strength", 0.1f, 0.0f, 0.0f, 0.0f, 0.0f, 10.0f},
|
||||
{ SOCK_FLOAT, 1, "Height", 1.0f, 1.0f, 1.0f, 1.0f, -1000.0f, 1000.0f, PROP_NONE, SOCK_HIDE_VALUE},
|
||||
{ SOCK_FLOAT, 1, N_("Strength"), 0.1f, 0.0f, 0.0f, 0.0f, 0.0f, 10.0f},
|
||||
{ SOCK_FLOAT, 1, N_("Height"), 1.0f, 1.0f, 1.0f, 1.0f, -1000.0f, 1000.0f, PROP_NONE, SOCK_HIDE_VALUE},
|
||||
{ SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
|
||||
{ -1, 0, "" }
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user