diff options
Diffstat (limited to 'intern/cycles/render/nodes.cpp')
-rw-r--r-- | intern/cycles/render/nodes.cpp | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp index ac07d91c4ca..4b4958fe3da 100644 --- a/intern/cycles/render/nodes.cpp +++ b/intern/cycles/render/nodes.cpp @@ -922,6 +922,7 @@ NODE_DEFINE(NoiseTextureNode) SOCKET_IN_FLOAT(w, "W", 0.0f); SOCKET_IN_FLOAT(scale, "Scale", 1.0f); SOCKET_IN_FLOAT(detail, "Detail", 2.0f); + SOCKET_IN_FLOAT(roughness, "Roughness", 0.5f); SOCKET_IN_FLOAT(distortion, "Distortion", 0.0f); SOCKET_OUT_FLOAT(fac, "Fac"); @@ -940,6 +941,7 @@ void NoiseTextureNode::compile(SVMCompiler &compiler) ShaderInput *w_in = input("W"); ShaderInput *scale_in = input("Scale"); ShaderInput *detail_in = input("Detail"); + ShaderInput *roughness_in = input("Roughness"); ShaderInput *distortion_in = input("Distortion"); ShaderOutput *fac_out = output("Fac"); ShaderOutput *color_out = output("Color"); @@ -948,6 +950,7 @@ void NoiseTextureNode::compile(SVMCompiler &compiler) int w_stack_offset = compiler.stack_assign_if_linked(w_in); int scale_stack_offset = compiler.stack_assign_if_linked(scale_in); int detail_stack_offset = compiler.stack_assign_if_linked(detail_in); + int roughness_stack_offset = compiler.stack_assign_if_linked(roughness_in); int distortion_stack_offset = compiler.stack_assign_if_linked(distortion_in); int fac_stack_offset = compiler.stack_assign_if_linked(fac_out); int color_stack_offset = compiler.stack_assign_if_linked(color_out); @@ -957,11 +960,13 @@ void NoiseTextureNode::compile(SVMCompiler &compiler) dimensions, compiler.encode_uchar4( vector_stack_offset, w_stack_offset, scale_stack_offset, detail_stack_offset), - compiler.encode_uchar4(distortion_stack_offset, fac_stack_offset, color_stack_offset)); - compiler.add_node(__float_as_int(w), - __float_as_int(scale), - __float_as_int(detail), - __float_as_int(distortion)); + compiler.encode_uchar4( + roughness_stack_offset, distortion_stack_offset, fac_stack_offset, color_stack_offset)); + compiler.add_node( + __float_as_int(w), __float_as_int(scale), __float_as_int(detail), __float_as_int(roughness)); + + compiler.add_node( + __float_as_int(distortion), SVM_STACK_INVALID, SVM_STACK_INVALID, SVM_STACK_INVALID); tex_mapping.compile_end(compiler, vector_in, vector_stack_offset); } @@ -1343,14 +1348,14 @@ NODE_DEFINE(WaveTextureNode) profile_enum.insert("tri", NODE_WAVE_PROFILE_TRI); SOCKET_ENUM(profile, "Profile", profile_enum, NODE_WAVE_PROFILE_SIN); + SOCKET_IN_POINT( + vector, "Vector", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_TEXTURE_GENERATED); SOCKET_IN_FLOAT(scale, "Scale", 1.0f); SOCKET_IN_FLOAT(distortion, "Distortion", 0.0f); SOCKET_IN_FLOAT(detail, "Detail", 2.0f); SOCKET_IN_FLOAT(detail_scale, "Detail Scale", 0.0f); + SOCKET_IN_FLOAT(detail_roughness, "Detail Roughness", 0.5f); SOCKET_IN_FLOAT(phase, "Phase Offset", 0.0f); - SOCKET_IN_POINT( - vector, "Vector", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_TEXTURE_GENERATED); - SOCKET_OUT_COLOR(color, "Color"); SOCKET_OUT_FLOAT(fac, "Fac"); @@ -1368,6 +1373,7 @@ void WaveTextureNode::compile(SVMCompiler &compiler) ShaderInput *distortion_in = input("Distortion"); ShaderInput *detail_in = input("Detail"); ShaderInput *dscale_in = input("Detail Scale"); + ShaderInput *droughness_in = input("Detail Roughness"); ShaderInput *phase_in = input("Phase Offset"); ShaderOutput *color_out = output("Color"); ShaderOutput *fac_out = output("Fac"); @@ -1378,20 +1384,22 @@ void WaveTextureNode::compile(SVMCompiler &compiler) compiler.encode_uchar4(type, bands_direction, rings_direction, profile), compiler.encode_uchar4(vector_offset, compiler.stack_assign_if_linked(scale_in), - compiler.stack_assign_if_linked(distortion_in), - compiler.stack_assign_if_linked(detail_in)), - compiler.encode_uchar4(compiler.stack_assign_if_linked(dscale_in), - compiler.stack_assign_if_linked(phase_in), - compiler.stack_assign_if_linked(color_out), - compiler.stack_assign_if_linked(fac_out))); + compiler.stack_assign_if_linked(distortion_in)), + compiler.encode_uchar4(compiler.stack_assign_if_linked(detail_in), + compiler.stack_assign_if_linked(dscale_in), + compiler.stack_assign_if_linked(droughness_in), + compiler.stack_assign_if_linked(phase_in))); - compiler.add_node(__float_as_int(scale), - __float_as_int(detail), + compiler.add_node(compiler.encode_uchar4(compiler.stack_assign_if_linked(color_out), + compiler.stack_assign_if_linked(fac_out)), + __float_as_int(scale), __float_as_int(distortion), - __float_as_int(detail_scale)); + __float_as_int(detail)); - compiler.add_node( - __float_as_int(phase), SVM_STACK_INVALID, SVM_STACK_INVALID, SVM_STACK_INVALID); + compiler.add_node(__float_as_int(detail_scale), + __float_as_int(detail_roughness), + __float_as_int(phase), + SVM_STACK_INVALID); tex_mapping.compile_end(compiler, vector_in, vector_offset); } |