MaterialX: split standard_surface into basic nodes #26

Merged
Bogdan Nagirniak merged 11 commits from matx-principlebsdf-split into matx-export-material 2023-09-21 10:58:14 +02:00
2 changed files with 233 additions and 189 deletions
Showing only changes of commit 4a2633b85d - Show all commits

View File

@ -287,11 +287,6 @@ static void node_shader_update_principled(bNodeTree *ntree, bNode *node)
NODE_SHADER_MATERIALX_BEGIN NODE_SHADER_MATERIALX_BEGIN
#ifdef WITH_MATERIALX #ifdef WITH_MATERIALX
{ {
if (to_type_ != NodeItem::Type::SurfaceShader) {
/* TODO: implement for BSDF and EDF */
return empty();
}
NodeItem base_color = get_input_value("Base Color", NodeItem::Type::Color3); NodeItem base_color = get_input_value("Base Color", NodeItem::Type::Color3);
NodeItem subsurface = get_input_value("Subsurface", NodeItem::Type::Float); NodeItem subsurface = get_input_value("Subsurface", NodeItem::Type::Float);
@ -330,198 +325,247 @@ NODE_SHADER_MATERIALX_BEGIN
subsurface_radius = subsurface_radius * subsurface_scale; subsurface_radius = subsurface_radius * subsurface_scale;
NodeItem n_main_tangent = empty(); NodeItem res = empty();
if (tangent) { if (to_type_ == NodeItem::Type::BSDF) {
NodeItem n_tangent_rotate = create_node("rotate3d", NodeItem::Type::Vector3); NodeItem n_main_tangent = empty();
n_tangent_rotate.set_input("in", tangent); if (tangent) {
n_tangent_rotate.set_input("amount", anisotropic_rotation * val(360.0f)); NodeItem n_tangent_rotate = create_node("rotate3d", NodeItem::Type::Vector3);
n_tangent_rotate.set_input("axis", normal); n_tangent_rotate.set_input("in", tangent);
n_tangent_rotate.set_input("amount", anisotropic_rotation * val(360.0f));
n_tangent_rotate.set_input("axis", normal);
NodeItem n_tangent_rotate_normalize = create_node("normalize", NodeItem::Type::Vector3); NodeItem n_tangent_rotate_normalize = create_node("normalize", NodeItem::Type::Vector3);
n_tangent_rotate_normalize.set_input("in", n_tangent_rotate); n_tangent_rotate_normalize.set_input("in", n_tangent_rotate);
DagerD marked this conversation as resolved Outdated

Rewrite create_node() with inputs parameter inside function.

Rewrite `create_node()` with `inputs` parameter inside function.
n_main_tangent = anisotropic.if_else( n_main_tangent = anisotropic.if_else(
NodeItem::CompareOp::Greater, val(0.0f), n_tangent_rotate_normalize, tangent); NodeItem::CompareOp::Greater, val(0.0f), n_tangent_rotate_normalize, tangent);
}
NodeItem n_coat_roughness_vector = create_node("roughness_anisotropy",
NodeItem::Type::Vector2);
n_coat_roughness_vector.set_input("roughness", roughness);
n_coat_roughness_vector.set_input("anisotropy", anisotropic);
NodeItem n_coat_bsdf = create_node("dielectric_bsdf", NodeItem::Type::BSDF);
n_coat_bsdf.set_input("weight", coat);
n_coat_bsdf.set_input("tint", val(MaterialX::Color3(1.0f, 1.0f, 1.0f)));
n_coat_bsdf.set_input("ior", ior);
n_coat_bsdf.set_input("scatter_mode", val(std::string("R")));
n_coat_bsdf.set_input("roughness", n_coat_roughness_vector);
if (normal) {
n_coat_bsdf.set_input("normal", normal);
}
if (tangent) {
NodeItem n_coat_tangent_rotate = create_node("rotate3d", NodeItem::Type::Vector3);
n_coat_tangent_rotate.set_input("in", tangent);
n_coat_tangent_rotate.set_input("amount", anisotropic_rotation * val(360.0f));
n_coat_tangent_rotate.set_input("axis", normal);
NodeItem n_coat_tangent_rotate_normalize = create_node("normalize", NodeItem::Type::Vector3);
n_coat_tangent_rotate_normalize.set_input("in", n_coat_tangent_rotate);
NodeItem n_coat_tangent = anisotropic.if_else(
NodeItem::CompareOp::Greater, val(0.0f), n_coat_tangent_rotate_normalize, tangent);
n_coat_bsdf.set_input("tangent", n_coat_tangent);
}
NodeItem n_thin_film_bsdf = create_node("thin_film_bsdf", NodeItem::Type::BSDF);
n_thin_film_bsdf.set_input("thickness", val(0.0f));
n_thin_film_bsdf.set_input("ior", val(1.5f));
NodeItem n_artistic_ior = create_node("artistic_ior", NodeItem::Type::Multioutput);
n_artistic_ior.set_input("reflectivity", base_color * val(1.0f));
n_artistic_ior.set_input("edge_color", base_color * specular);
NodeItem n_ior_out = n_artistic_ior.add_output("ior", NodeItem::Type::Color3);
NodeItem n_extinction_out = n_artistic_ior.add_output("extinction", NodeItem::Type::Color3);
NodeItem n_coat_affect_roughness_multiply2 = coat * val(0.0f) * roughness;
NodeItem n_coat_affected_roughness = create_node("mix", NodeItem::Type::Float);
n_coat_affected_roughness.set_input("fg", val(1.0f));
n_coat_affected_roughness.set_input("bg", roughness);
n_coat_affected_roughness.set_input("mix", n_coat_affect_roughness_multiply2);
NodeItem n_main_roughness = create_node("roughness_anisotropy", NodeItem::Type::Vector2);
n_main_roughness.set_input("roughness", n_coat_affected_roughness);
n_main_roughness.set_input("anisotropy", anisotropic);
NodeItem n_metal_bsdf = create_node("conductor_bsdf", NodeItem::Type::BSDF);
n_metal_bsdf.set_input("ior", n_ior_out);
n_metal_bsdf.set_input("extinction", n_extinction_out);
n_metal_bsdf.set_input("roughness", n_main_roughness);
if (normal) {
n_metal_bsdf.set_input("normal", normal);
}
if (n_main_tangent) {
n_metal_bsdf.set_input("tangent", n_main_tangent);
}
NodeItem n_specular_bsdf = create_node("dielectric_bsdf", NodeItem::Type::BSDF);
n_specular_bsdf.set_input("weight", specular);
n_specular_bsdf.set_input("tint", base_color);
n_specular_bsdf.set_input("ior", ior);
n_specular_bsdf.set_input("scatter_mode", val(std::string("R")));
n_specular_bsdf.set_input("roughness", n_main_roughness);
if (normal) {
n_specular_bsdf.set_input("normal", normal);
}
if (n_main_tangent) {
n_specular_bsdf.set_input("tangent", n_main_tangent);
}
NodeItem n_coat_affected_transmission_roughness = create_node("mix", NodeItem::Type::Float);
n_coat_affected_transmission_roughness.set_input("fg", val(1.0f));
n_coat_affected_transmission_roughness.set_input("bg",
(roughness + roughness).clamp(0.0f, 1.0f));
n_coat_affected_transmission_roughness.set_input("mix", n_coat_affect_roughness_multiply2);
NodeItem n_transmission_roughness = create_node("roughness_anisotropy",
NodeItem::Type::Vector2);
n_transmission_roughness.set_input("roughness", n_coat_affected_transmission_roughness);
n_transmission_roughness.set_input("anisotropy", anisotropic);
NodeItem n_transmission_bsdf = create_node("dielectric_bsdf", NodeItem::Type::BSDF);
n_transmission_bsdf.set_input("tint", base_color);
n_transmission_bsdf.set_input("ior", ior);
n_transmission_bsdf.set_input("roughness", n_transmission_roughness);
if (normal) {
n_transmission_bsdf.set_input("normal", normal);
}
if (n_main_tangent) {
n_transmission_bsdf.set_input("tangent", n_main_tangent);
}
NodeItem n_coat_gamma = coat.clamp(0.0f, 1.0f) * val(0.0f) + val(1.0f);
NodeItem n_coat_affected_subsurface_color = base_color.max(val(0.0f)) ^ n_coat_gamma;
NodeItem n_translucent_bsdf = create_node("translucent_bsdf", NodeItem::Type::BSDF);
n_translucent_bsdf.set_input("color", n_coat_affected_subsurface_color);
if (normal) {
n_translucent_bsdf.set_input("normal", normal);
}
NodeItem n_subsurface_bsdf = create_node("subsurface_bsdf", NodeItem::Type::BSDF);
n_subsurface_bsdf.set_input("color", n_coat_affected_subsurface_color);
n_subsurface_bsdf.set_input("radius", subsurface_radius);
n_subsurface_bsdf.set_input("anisotropy", anisotropic);
if (normal) {
n_subsurface_bsdf.set_input("normal", normal);
}
NodeItem n_selected_subsurface_bsdf = create_node("mix", NodeItem::Type::BSDF);
n_selected_subsurface_bsdf.set_input("fg", n_translucent_bsdf);
n_selected_subsurface_bsdf.set_input("bg", n_subsurface_bsdf);
n_selected_subsurface_bsdf.set_input("mix", val(0.0f));
NodeItem n_sheen_bsdf = create_node("sheen_bsdf", NodeItem::Type::BSDF);
n_sheen_bsdf.set_input("weight", sheen);
n_sheen_bsdf.set_input("color", base_color);
n_sheen_bsdf.set_input("roughness", roughness);
if (normal) {
n_sheen_bsdf.set_input("normal", normal);
}
NodeItem n_diffuse_bsdf = create_node("oren_nayar_diffuse_bsdf", NodeItem::Type::BSDF);
n_diffuse_bsdf.set_input("color", base_color.max(val(0.0f)) ^ n_coat_gamma);
n_diffuse_bsdf.set_input("roughness", roughness);
n_diffuse_bsdf.set_input("weight", val(1.0f));
if (normal) {
n_diffuse_bsdf.set_input("normal", normal);
}
NodeItem n_subsurface_mix = create_node("mix", NodeItem::Type::BSDF);
n_subsurface_mix.set_input("fg", n_selected_subsurface_bsdf);
n_subsurface_mix.set_input("bg", n_diffuse_bsdf);
n_subsurface_mix.set_input("mix", subsurface);
NodeItem n_sheen_layer = create_node("layer", NodeItem::Type::BSDF);
n_sheen_layer.set_input("top", n_sheen_bsdf);
n_sheen_layer.set_input("base", n_subsurface_mix);
NodeItem n_transmission_mix = create_node("mix", NodeItem::Type::BSDF);
n_transmission_mix.set_input("fg", n_transmission_bsdf);
n_transmission_mix.set_input("bg", n_sheen_layer);
n_transmission_mix.set_input("mix", transmission);
NodeItem n_specular_layer = create_node("layer", NodeItem::Type::BSDF);
n_specular_layer.set_input("top", n_specular_bsdf);
n_specular_layer.set_input("base", n_transmission_mix);
NodeItem n_metalness_mix = create_node("mix", NodeItem::Type::BSDF);
n_metalness_mix.set_input("fg", n_metal_bsdf);
n_metalness_mix.set_input("bg", n_specular_layer);
n_metalness_mix.set_input("mix", metallic);
NodeItem n_thin_film_layer = create_node("layer", NodeItem::Type::BSDF);
n_thin_film_layer.set_input("top", n_thin_film_bsdf);
n_thin_film_layer.set_input("base", n_metalness_mix);
NodeItem n_opacity_luminance = create_node("luminance", NodeItem::Type::Color3);
n_opacity_luminance.set_input("in", val(MaterialX::Color3(1.0f, 1.0f, 1.0f)));
NodeItem n_coat_attenuation = create_node("mix", NodeItem::Type::Color3);
n_coat_attenuation.set_input("fg", base_color);
n_coat_attenuation.set_input("bg", val(MaterialX::Color3(1.0f, 1.0f, 1.0f)));
n_coat_attenuation.set_input("mix", coat);
res = create_node("layer", NodeItem::Type::BSDF);
res.set_input("top", n_coat_bsdf);
res.set_input("base", n_thin_film_layer * n_coat_attenuation);
return res;
} }
else if (to_type_ == NodeItem::Type::EDF) {
NodeItem n_coat_roughness_vector = create_node("roughness_anisotropy", NodeItem::Type::Vector2); res = create_node("uniform_edf", NodeItem::Type::EDF);
n_coat_roughness_vector.set_input("roughness", roughness); res.set_input("color", emission * emission_strength);
DagerD marked this conversation as resolved Outdated

This node is created in MaterialOutput.
Should be:

if (to_type_ == NodeItem::Type::BSDF) {
<calculate and return only BSDF part>
....
return n_coat_layer; // probably n_coat_layer * n_opacity_luminance
}
else if (to_type_ == NodeItem::Type::EDF) {
<calculate and return only EDF part>
...
return n_emission_edf; // probably n_emission_edf * n_opacity_luminance
}
else if (to_type_ == NodeItem::Type::SurfaceShader) {
<previous implementation>
}
This node is created in MaterialOutput. Should be: ``` if (to_type_ == NodeItem::Type::BSDF) { <calculate and return only BSDF part> .... return n_coat_layer; // probably n_coat_layer * n_opacity_luminance } else if (to_type_ == NodeItem::Type::EDF) { <calculate and return only EDF part> ... return n_emission_edf; // probably n_emission_edf * n_opacity_luminance } else if (to_type_ == NodeItem::Type::SurfaceShader) { <previous implementation> } ```
n_coat_roughness_vector.set_input("anisotropy", anisotropic);
NodeItem n_coat_bsdf = create_node("dielectric_bsdf", NodeItem::Type::BSDF);
n_coat_bsdf.set_input("weight", coat);
n_coat_bsdf.set_input("tint", val(MaterialX::Color3(1.0f, 1.0f, 1.0f)));
n_coat_bsdf.set_input("ior", ior);
n_coat_bsdf.set_input("scatter_mode", val(std::string("R")));
n_coat_bsdf.set_input("roughness", n_coat_roughness_vector);
if (normal) {
n_coat_bsdf.set_input("normal", normal);
} }
else if (to_type_ == NodeItem::Type::SurfaceShader) {
res = create_node("standard_surface", NodeItem::Type::SurfaceShader);
res.set_input("base", val(1.0f));
res.set_input("base_color", base_color);
res.set_input("diffuse_roughness", roughness);
if (normal) {
res.set_input("normal", normal);
}
if (tangent) {
res.set_input("tangent", tangent);
}
res.set_input("metalness", metallic);
if (tangent) { res.set_input("specular", specular);
NodeItem n_coat_tangent_rotate = create_node("rotate3d", NodeItem::Type::Vector3); res.set_input("specular_color", base_color);
n_coat_tangent_rotate.set_input("in", tangent); res.set_input("specular_roughness", roughness);
n_coat_tangent_rotate.set_input("amount", anisotropic_rotation * val(360.0f)); res.set_input("specular_IOR", ior);
n_coat_tangent_rotate.set_input("axis", normal); res.set_input("specular_anisotropy", anisotropic);
res.set_input("specular_rotation", anisotropic_rotation);
NodeItem n_coat_tangent_rotate_normalize = create_node("normalize", NodeItem::Type::Vector3); res.set_input("transmission", transmission);
n_coat_tangent_rotate_normalize.set_input("in", n_coat_tangent_rotate); res.set_input("transmission_color", base_color);
res.set_input("transmission_extra_roughness", roughness);
NodeItem n_coat_tangent = anisotropic.if_else( res.set_input("subsurface", subsurface);
NodeItem::CompareOp::Greater, val(0.0f), n_coat_tangent_rotate_normalize, tangent); res.set_input("subsurface_color", base_color);
res.set_input("subsurface_radius", subsurface_radius);
res.set_input("subsurface_anisotropy", anisotropic);
n_coat_bsdf.set_input("tangent", n_coat_tangent); res.set_input("sheen", sheen);
res.set_input("sheen_color", base_color);
res.set_input("sheen_roughness", roughness);
res.set_input("coat", coat);
res.set_input("coat_color", base_color);
res.set_input("coat_roughness", coat_roughness);
res.set_input("coat_IOR", ior);
res.set_input("coat_anisotropy", anisotropic);
res.set_input("coat_rotation", anisotropic_rotation);
if (coat_normal) {
res.set_input("coat_normal", coat_normal);
}
res.set_input("emission", emission_strength);
res.set_input("emission_color", emission);
} }
NodeItem n_thin_film_bsdf = create_node("thin_film_bsdf", NodeItem::Type::BSDF);
n_thin_film_bsdf.set_input("thickness", val(0.0f));
n_thin_film_bsdf.set_input("ior", val(1.5f));
NodeItem n_artistic_ior = create_node("artistic_ior", NodeItem::Type::Multioutput);
n_artistic_ior.set_input("reflectivity", base_color * val(1.0f));
n_artistic_ior.set_input("edge_color", base_color * specular);
NodeItem n_ior_out = n_artistic_ior.add_output("ior", NodeItem::Type::Color3);
NodeItem n_extinction_out = n_artistic_ior.add_output("extinction", NodeItem::Type::Color3);
NodeItem n_coat_affect_roughness_multiply2 = coat * val(0.0f) * roughness;
NodeItem n_coat_affected_roughness = create_node("mix", NodeItem::Type::Float);
n_coat_affected_roughness.set_input("fg", val(1.0f));
n_coat_affected_roughness.set_input("bg", roughness);
n_coat_affected_roughness.set_input("mix", n_coat_affect_roughness_multiply2);
NodeItem n_main_roughness = create_node("roughness_anisotropy", NodeItem::Type::Vector2);
n_main_roughness.set_input("roughness", n_coat_affected_roughness);
n_main_roughness.set_input("anisotropy", anisotropic);
NodeItem n_metal_bsdf = create_node("conductor_bsdf", NodeItem::Type::BSDF);
n_metal_bsdf.set_input("ior", n_ior_out);
n_metal_bsdf.set_input("extinction", n_extinction_out);
n_metal_bsdf.set_input("roughness", n_main_roughness);
if (normal) {
n_metal_bsdf.set_input("normal", normal);
}
if (n_main_tangent) {
n_metal_bsdf.set_input("tangent", n_main_tangent);
}
NodeItem n_specular_bsdf = create_node("dielectric_bsdf", NodeItem::Type::BSDF);
n_specular_bsdf.set_input("weight", specular);
n_specular_bsdf.set_input("tint", base_color);
n_specular_bsdf.set_input("ior", ior);
n_specular_bsdf.set_input("scatter_mode", val(std::string("R")));
n_specular_bsdf.set_input("roughness", n_main_roughness);
if (normal) {
n_specular_bsdf.set_input("normal", normal);
}
if (n_main_tangent) {
n_specular_bsdf.set_input("tangent", n_main_tangent);
}
NodeItem n_coat_affected_transmission_roughness = create_node("mix", NodeItem::Type::Float);
n_coat_affected_transmission_roughness.set_input("fg", val(1.0f));
n_coat_affected_transmission_roughness.set_input("bg",
(roughness + roughness).clamp(0.0f, 1.0f));
n_coat_affected_transmission_roughness.set_input("mix", n_coat_affect_roughness_multiply2);
NodeItem n_transmission_roughness = create_node("roughness_anisotropy", NodeItem::Type::Vector2);
n_transmission_roughness.set_input("roughness", n_coat_affected_transmission_roughness);
n_transmission_roughness.set_input("anisotropy", anisotropic);
NodeItem n_transmission_bsdf = create_node("dielectric_bsdf", NodeItem::Type::BSDF);
n_transmission_bsdf.set_input("tint", base_color);
n_transmission_bsdf.set_input("ior", ior);
n_transmission_bsdf.set_input("roughness", n_transmission_roughness);
if (normal) {
n_transmission_bsdf.set_input("normal", normal);
}
if (n_main_tangent) {
n_transmission_bsdf.set_input("tangent", n_main_tangent);
}
NodeItem n_coat_gamma = coat.clamp(0.0f, 1.0f) * val(0.0f) + val(1.0f);
NodeItem n_coat_affected_subsurface_color = base_color.max(val(0.0f)) ^ n_coat_gamma;
NodeItem n_translucent_bsdf = create_node("translucent_bsdf", NodeItem::Type::BSDF);
n_translucent_bsdf.set_input("color", n_coat_affected_subsurface_color);
if (normal) {
n_translucent_bsdf.set_input("normal", normal);
}
NodeItem n_subsurface_bsdf = create_node("subsurface_bsdf", NodeItem::Type::BSDF);
n_subsurface_bsdf.set_input("color", n_coat_affected_subsurface_color);
n_subsurface_bsdf.set_input("radius", subsurface_radius);
n_subsurface_bsdf.set_input("anisotropy", anisotropic);
if (normal) {
n_subsurface_bsdf.set_input("normal", normal);
}
NodeItem n_selected_subsurface_bsdf = create_node("mix", NodeItem::Type::BSDF);
n_selected_subsurface_bsdf.set_input("fg", n_translucent_bsdf);
n_selected_subsurface_bsdf.set_input("bg", n_subsurface_bsdf);
n_selected_subsurface_bsdf.set_input("mix", val(0.0f));
NodeItem n_sheen_bsdf = create_node("sheen_bsdf", NodeItem::Type::BSDF);
n_sheen_bsdf.set_input("weight", sheen);
n_sheen_bsdf.set_input("color", base_color);
n_sheen_bsdf.set_input("roughness", roughness);
if (normal) {
n_sheen_bsdf.set_input("normal", normal);
}
NodeItem n_diffuse_bsdf = create_node("oren_nayar_diffuse_bsdf", NodeItem::Type::BSDF);
n_diffuse_bsdf.set_input("color", base_color.max(val(0.0f)) ^ n_coat_gamma);
n_diffuse_bsdf.set_input("roughness", roughness);
n_diffuse_bsdf.set_input("weight", val(1.0f));
if (normal) {
n_diffuse_bsdf.set_input("normal", normal);
}
NodeItem n_subsurface_mix = create_node("mix", NodeItem::Type::BSDF);
n_subsurface_mix.set_input("fg", n_selected_subsurface_bsdf);
n_subsurface_mix.set_input("bg", n_diffuse_bsdf);
n_subsurface_mix.set_input("mix", subsurface);
NodeItem n_sheen_layer = create_node("layer", NodeItem::Type::BSDF);
n_sheen_layer.set_input("top", n_sheen_bsdf);
n_sheen_layer.set_input("base", n_subsurface_mix);
NodeItem n_transmission_mix = create_node("mix", NodeItem::Type::BSDF);
n_transmission_mix.set_input("fg", n_transmission_bsdf);
n_transmission_mix.set_input("bg", n_sheen_layer);
n_transmission_mix.set_input("mix", transmission);
NodeItem n_specular_layer = create_node("layer", NodeItem::Type::BSDF);
n_specular_layer.set_input("top", n_specular_bsdf);
n_specular_layer.set_input("base", n_transmission_mix);
NodeItem n_metalness_mix = create_node("mix", NodeItem::Type::BSDF);
n_metalness_mix.set_input("fg", n_metal_bsdf);
n_metalness_mix.set_input("bg", n_specular_layer);
n_metalness_mix.set_input("mix", metallic);
NodeItem n_thin_film_layer = create_node("layer", NodeItem::Type::BSDF);
n_thin_film_layer.set_input("top", n_thin_film_bsdf);
n_thin_film_layer.set_input("base", n_metalness_mix);
NodeItem n_opacity_luminance = create_node("luminance", NodeItem::Type::Color3);
n_opacity_luminance.set_input("in", val(MaterialX::Color3(1.0f, 1.0f, 1.0f)));
NodeItem n_emission_edf = create_node("uniform_edf", NodeItem::Type::EDF);
n_emission_edf.set_input("color", emission * emission_strength);
NodeItem n_coat_attenuation = create_node("mix", NodeItem::Type::Color3);
n_coat_attenuation.set_input("fg", base_color);
n_coat_attenuation.set_input("bg", val(MaterialX::Color3(1.0f, 1.0f, 1.0f)));
n_coat_attenuation.set_input("mix", coat);
NodeItem n_coat_layer = create_node("layer", NodeItem::Type::BSDF);
n_coat_layer.set_input("top", n_coat_bsdf);
n_coat_layer.set_input("base", n_thin_film_layer * n_coat_attenuation);
NodeItem res = create_node("surface", NodeItem::Type::SurfaceShader);
res.set_input("bsdf", n_coat_layer);
res.set_input("edf", n_emission_edf);
res.set_input("opacity", n_opacity_luminance.extract(0));
return res; return res;
} }
#endif #endif

View File

@ -42,8 +42,8 @@ NODE_SHADER_MATERIALX_BEGIN
} }
else if (shader1 && shader2) { else if (shader1 && shader2) {
res = create_node("mix", to_type_); res = create_node("mix", to_type_);
res.set_input("fg", shader1); res.set_input("fg", shader2);
res.set_input("bg", shader2); res.set_input("bg", shader1);
res.set_input("mix", fac); res.set_input("mix", fac);
} }
break; break;