MaterialX: code improvements #34

Merged
Bogdan Nagirniak merged 2 commits from matx-nodes-polishing into matx-export-material 2023-09-26 07:29:05 +02:00
Showing only changes of commit 5dd8e7c2a9 - Show all commits

View File

@ -319,7 +319,7 @@ NODE_SHADER_MATERIALX_BEGIN
{"base_color", get_input_value("Base Color", NodeItem::Type::Color3)}, {"base_color", get_input_value("Base Color", NodeItem::Type::Color3)},
{"subsurface", get_input_value("Subsurface", NodeItem::Type::Float)}, {"subsurface", get_input_value("Subsurface", NodeItem::Type::Float)},
{"subsurface_scale", get_input_value("Subsurface Scale", NodeItem::Type::Float)}, {"subsurface_scale", get_input_value("Subsurface Scale", NodeItem::Type::Float)},
{"subsurface_radius", get_input_value("Subsurface Radius", NodeItem::Type::Color3)}, {"subsurface_radius", get_input_value("Subsurface Radius", NodeItem::Type::Vector3)},
//{"subsurface_ior", get_input_value("Subsurface IOR", NodeItem::Type::Vector3)}, //{"subsurface_ior", get_input_value("Subsurface IOR", NodeItem::Type::Vector3)},
{"subsurface_anisotropy", get_input_value("Subsurface Anisotropy", NodeItem::Type::Float)}, {"subsurface_anisotropy", get_input_value("Subsurface Anisotropy", NodeItem::Type::Float)},
{"metallic", get_input_value("Metallic", NodeItem::Type::Float)}, {"metallic", get_input_value("Metallic", NodeItem::Type::Float)},
@ -525,39 +525,41 @@ NODE_SHADER_MATERIALX_BEGIN
NodeItem anisotropic = in["anisotropic"]; NodeItem anisotropic = in["anisotropic"];
NodeItem rotation = in["anisotropic_rotation"]; NodeItem rotation = in["anisotropic_rotation"];
res = create_node("standard_surface", res = create_node(
NodeItem::Type::SurfaceShader, "standard_surface",
{{"base", val(1.0f)}, NodeItem::Type::SurfaceShader,
{"base_color", base_color}, {{"base", val(1.0f)},
{"diffuse_roughness", roughness}, {"base_color", base_color},
{"metalness", in["metallic"]}, {"diffuse_roughness", roughness},
{"specular", in["specular"]}, {"metalness", in["metallic"]},
{"specular_color", in["specular_tint"]}, {"specular", in["specular"]},
{"specular_roughness", roughness}, {"specular_color", in["specular_tint"]},
{"specular_IOR", in["ior"]}, {"specular_roughness", roughness},
{"specular_anisotropy", anisotropic}, {"specular_IOR", in["ior"]},
{"specular_rotation", rotation}, {"specular_anisotropy", anisotropic},
{"transmission", in["transmission"]}, {"specular_rotation", rotation},
{"transmission_color", base_color}, {"transmission", in["transmission"]},
{"transmission_extra_roughness", roughness}, {"transmission_color", base_color},
{"subsurface", in["subsurface"]}, {"transmission_extra_roughness", roughness},
{"subsurface_color", base_color}, {"subsurface", in["subsurface"]},
{"subsurface_radius", in["subsurface_radius"] * in["subsurface_scale"]}, {"subsurface_color", base_color},
{"subsurface_anisotropy", in["subsurface_anisotropy"]}, {"subsurface_radius",
{"sheen", in["sheen"]}, (in["subsurface_radius"] * in["subsurface_scale"]).convert(NodeItem::Type::Color3)},
{"sheen_color", in["sheen_tint"]}, {"subsurface_anisotropy", in["subsurface_anisotropy"]},
{"sheen_roughness", in["sheen_roughness"]}, {"sheen", in["sheen"]},
{"coat", in["coat"]}, {"sheen_color", in["sheen_tint"]},
{"coat_color", in["coat_tint"]}, {"sheen_roughness", in["sheen_roughness"]},
{"coat_roughness", in["coat_roughness"]}, {"coat", in["coat"]},
{"coat_IOR", in["coat_ior"]}, {"coat_color", in["coat_tint"]},
{"coat_anisotropy", anisotropic}, {"coat_roughness", in["coat_roughness"]},
{"coat_rotation", rotation}, {"coat_IOR", in["coat_ior"]},
{"coat_normal", in["coat_normal"]}, {"coat_anisotropy", anisotropic},
{"emission", in["emission"]}, {"coat_rotation", rotation},
{"emission_color", in["emission_color"]}, {"coat_normal", in["coat_normal"]},
{"normal", in["normal"]}, {"emission", in["emission"]},
{"tangent", in["tangent"]}}); {"emission_color", in["emission_color"]},
{"normal", in["normal"]},
{"tangent", in["tangent"]}});
break; break;
} }
default: default: