diff --git a/src/appleseed-max-impl/appleseeddisneymtl/appleseeddisneymtl.cpp b/src/appleseed-max-impl/appleseeddisneymtl/appleseeddisneymtl.cpp index 144cafd..2f3b88c 100644 --- a/src/appleseed-max-impl/appleseeddisneymtl/appleseeddisneymtl.cpp +++ b/src/appleseed-max-impl/appleseeddisneymtl/appleseeddisneymtl.cpp @@ -760,7 +760,7 @@ asf::auto_release_ptr AppleseedDisneyMtl::create_osl_material( else { // Normal mapping. - connect_normal_map(shader_group.ref(), name, "Normal", "Tn", m_bump_texmap, m_bump_up_vector); + connect_normal_map(shader_group.ref(), name, "Normal", "Tn", m_bump_texmap, m_bump_up_vector, m_bump_amount); } } diff --git a/src/appleseed-max-impl/appleseedglassmtl/appleseedglassmtl.cpp b/src/appleseed-max-impl/appleseedglassmtl/appleseedglassmtl.cpp index 3bf4556..71658a0 100644 --- a/src/appleseed-max-impl/appleseedglassmtl/appleseedglassmtl.cpp +++ b/src/appleseed-max-impl/appleseedglassmtl/appleseedglassmtl.cpp @@ -677,7 +677,7 @@ asf::auto_release_ptr AppleseedGlassMtl::create_osl_material( else { // Normal mapping. - connect_normal_map(shader_group.ref(), name, "Normal", "Tn", m_bump_texmap, m_bump_up_vector); + connect_normal_map(shader_group.ref(), name, "Normal", "Tn", m_bump_texmap, m_bump_up_vector, m_bump_amount); } } diff --git a/src/appleseed-max-impl/appleseedmetalmtl/appleseedmetalmtl.cpp b/src/appleseed-max-impl/appleseedmetalmtl/appleseedmetalmtl.cpp index dc25bc0..4e86362 100644 --- a/src/appleseed-max-impl/appleseedmetalmtl/appleseedmetalmtl.cpp +++ b/src/appleseed-max-impl/appleseedmetalmtl/appleseedmetalmtl.cpp @@ -656,7 +656,7 @@ asf::auto_release_ptr AppleseedMetalMtl::create_osl_material( else { // Normal mapping. - connect_normal_map(shader_group.ref(), name, "Normal", "Tn", m_bump_texmap, m_bump_up_vector); + connect_normal_map(shader_group.ref(), name, "Normal", "Tn", m_bump_texmap, m_bump_up_vector, m_bump_amount); } } diff --git a/src/appleseed-max-impl/appleseedoslplugin/oslmaterial.cpp b/src/appleseed-max-impl/appleseedoslplugin/oslmaterial.cpp index 3d7ed78..29776f8 100644 --- a/src/appleseed-max-impl/appleseedoslplugin/oslmaterial.cpp +++ b/src/appleseed-max-impl/appleseedoslplugin/oslmaterial.cpp @@ -518,7 +518,14 @@ asf::auto_release_ptr OSLMaterial::create_osl_material( else if (m_has_normal_params) { // Normal mapping. - connect_normal_map(shader_group.ref(), name, bump_param->m_param_name.c_str(), "Tn", bump_texmap, bump_up_vector); + connect_normal_map( + shader_group.ref(), + name, + bump_param->m_param_name.c_str(), + "Tn", + bump_texmap, + bump_up_vector, + bump_amount); } } } diff --git a/src/appleseed-max-impl/appleseedplasticmtl/appleseedplasticmtl.cpp b/src/appleseed-max-impl/appleseedplasticmtl/appleseedplasticmtl.cpp index 5255df0..3ca37b9 100644 --- a/src/appleseed-max-impl/appleseedplasticmtl/appleseedplasticmtl.cpp +++ b/src/appleseed-max-impl/appleseedplasticmtl/appleseedplasticmtl.cpp @@ -677,7 +677,7 @@ asf::auto_release_ptr AppleseedPlasticMtl::create_osl_material( else { // Normal mapping. - connect_normal_map(shader_group.ref(), name, "Normal", "Tn", m_bump_texmap, m_bump_up_vector); + connect_normal_map(shader_group.ref(), name, "Normal", "Tn", m_bump_texmap, m_bump_up_vector, m_bump_amount); } } diff --git a/src/appleseed-max-impl/appleseedsssmtl/appleseedsssmtl.cpp b/src/appleseed-max-impl/appleseedsssmtl/appleseedsssmtl.cpp index 778252e..c1966f0 100644 --- a/src/appleseed-max-impl/appleseedsssmtl/appleseedsssmtl.cpp +++ b/src/appleseed-max-impl/appleseedsssmtl/appleseedsssmtl.cpp @@ -697,7 +697,7 @@ asf::auto_release_ptr AppleseedSSSMtl::create_osl_material( else { // Normal mapping. - connect_normal_map(shader_group.ref(), name, "Normal", "Tn", m_bump_texmap, m_bump_up_vector); + connect_normal_map(shader_group.ref(), name, "Normal", "Tn", m_bump_texmap, m_bump_up_vector, m_bump_amount); } } diff --git a/src/appleseed-max-impl/bump/bumpparammapdlgproc.h b/src/appleseed-max-impl/bump/bumpparammapdlgproc.h index e0c4a52..11207da 100644 --- a/src/appleseed-max-impl/bump/bumpparammapdlgproc.h +++ b/src/appleseed-max-impl/bump/bumpparammapdlgproc.h @@ -84,8 +84,6 @@ class BumpParamMapDlgProc void enable_disable_controls(HWND hwnd) { auto selected = SendMessage(GetDlgItem(hwnd, IDC_COMBO_BUMP_METHOD), CB_GETCURSEL, 0, 0); - EnableWindow(GetDlgItem(hwnd, IDC_EDIT_BUMP_AMOUNT), selected == 0 ? TRUE : FALSE); - EnableWindow(GetDlgItem(hwnd, IDC_SPINNER_BUMP_AMOUNT), selected == 0 ? TRUE : FALSE); EnableWindow(GetDlgItem(hwnd, IDC_COMBO_BUMP_UP_VECTOR), selected == 1 ? TRUE : FALSE); } }; diff --git a/src/appleseed-max-impl/oslutils.cpp b/src/appleseed-max-impl/oslutils.cpp index 96d9fa5..d3b856d 100644 --- a/src/appleseed-max-impl/oslutils.cpp +++ b/src/appleseed-max-impl/oslutils.cpp @@ -451,7 +451,8 @@ void connect_normal_map( const char* material_normal_input_name, const char* material_tn_input_name, Texmap* texmap, - const int up_vector) + const int up_vector, + const float amount) { if (is_supported_procedural_texture(texmap, false) || is_osl_texture(texmap)) { @@ -466,7 +467,8 @@ void connect_normal_map( shader_group.add_shader("shader", "as_max_normal_map", normal_map_layer_name.c_str(), asr::ParamArray() - .insert("UpVector", fmt_osl_expr(up_vector == 0 ? "Green" : "Blue"))); + .insert("UpVector", fmt_osl_expr(up_vector == 0 ? "Green" : "Blue")) + .insert("Amount", fmt_osl_expr(amount))); shader_group.add_connection( normal_map_layer_name.c_str(), "NormalOut", @@ -491,7 +493,8 @@ void connect_normal_map( auto normal_map_layer_name = asf::format("{0}_normal_map", material_node_name); shader_group.add_shader("shader", "as_max_normal_map", normal_map_layer_name.c_str(), asr::ParamArray() - .insert("UpVector", fmt_osl_expr(up_vector == 0 ? "Green" : "Blue"))); + .insert("UpVector", fmt_osl_expr(up_vector == 0 ? "Green" : "Blue")) + .insert("Amount", fmt_osl_expr(amount))); shader_group.add_connection( uv_transform_layer_name.c_str(), "out_U", diff --git a/src/appleseed-max-impl/oslutils.h b/src/appleseed-max-impl/oslutils.h index c85c1fe..017f3b8 100644 --- a/src/appleseed-max-impl/oslutils.h +++ b/src/appleseed-max-impl/oslutils.h @@ -97,7 +97,8 @@ void connect_normal_map( const char* material_normal_input_name, const char* material_tn_input_name, Texmap* texmap, - const int up_vector); + const int up_vector, + const float amount); void connect_sub_mtl( renderer::Assembly& assembly,