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
10 changed files with 44 additions and 41 deletions

View File

@ -42,7 +42,7 @@ static int gpu_shader_bevel(GPUMaterial *mat,
NODE_SHADER_MATERIALX_BEGIN NODE_SHADER_MATERIALX_BEGIN
#ifdef WITH_MATERIALX #ifdef WITH_MATERIALX
{ {
/* NOTE: This node doesn't have an implementation in MaterialX.*/ /* NOTE: This node isn't supported by MaterialX.*/
return get_input_link("Normal", NodeItem::Type::Vector3); return get_input_link("Normal", NodeItem::Type::Vector3);
} }
#endif #endif

View File

@ -525,7 +525,8 @@ 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(
"standard_surface",
NodeItem::Type::SurfaceShader, NodeItem::Type::SurfaceShader,
{{"base", val(1.0f)}, {{"base", val(1.0f)},
{"base_color", base_color}, {"base_color", base_color},
@ -542,7 +543,8 @@ NODE_SHADER_MATERIALX_BEGIN
{"transmission_extra_roughness", roughness}, {"transmission_extra_roughness", roughness},
{"subsurface", in["subsurface"]}, {"subsurface", in["subsurface"]},
{"subsurface_color", base_color}, {"subsurface_color", base_color},
{"subsurface_radius", in["subsurface_radius"] * in["subsurface_scale"]}, {"subsurface_radius",
(in["subsurface_radius"] * in["subsurface_scale"]).convert(NodeItem::Type::Color3)},
{"subsurface_anisotropy", in["subsurface_anisotropy"]}, {"subsurface_anisotropy", in["subsurface_anisotropy"]},
{"sheen", in["sheen"]}, {"sheen", in["sheen"]},
{"sheen_color", in["sheen_tint"]}, {"sheen_color", in["sheen_tint"]},

View File

@ -61,7 +61,7 @@ static int node_shader_gpu_geometry(GPUMaterial *mat,
NODE_SHADER_MATERIALX_BEGIN NODE_SHADER_MATERIALX_BEGIN
#ifdef WITH_MATERIALX #ifdef WITH_MATERIALX
{ {
/* NOTE: Some outputs don't have an implementation in MaterialX.*/ /* NOTE: Some outputs aren't supported by MaterialX.*/
NodeItem res = empty(); NodeItem res = empty();
std::string name = socket_out_->name; std::string name = socket_out_->name;

View File

@ -35,7 +35,7 @@ static int node_shader_gpu_light_path(GPUMaterial *mat,
NODE_SHADER_MATERIALX_BEGIN NODE_SHADER_MATERIALX_BEGIN
#ifdef WITH_MATERIALX #ifdef WITH_MATERIALX
{ {
/* This node isn't supported by MaterialX. Only default values returned. */ /* NOTE: This node isn't supported by MaterialX. Only default values returned. */
if (STREQ(socket_out_->name, "Is Camera Ray")) { if (STREQ(socket_out_->name, "Is Camera Ray")) {
return val(1.0f); return val(1.0f);
} }

View File

@ -33,7 +33,7 @@ static int node_shader_gpu_object_info(GPUMaterial *mat,
NODE_SHADER_MATERIALX_BEGIN NODE_SHADER_MATERIALX_BEGIN
#ifdef WITH_MATERIALX #ifdef WITH_MATERIALX
{ {
/* NOTE: Some outputs don't have an implementation in MaterialX.*/ /* NOTE: Some outputs isn't supported by MaterialX.*/
NodeItem res = empty(); NodeItem res = empty();
std::string name = socket_out_->name; std::string name = socket_out_->name;

View File

@ -37,7 +37,7 @@ static int gpu_shader_particle_info(GPUMaterial *mat,
NODE_SHADER_MATERIALX_BEGIN NODE_SHADER_MATERIALX_BEGIN
#ifdef WITH_MATERIALX #ifdef WITH_MATERIALX
{ {
/* NOTE: This node doesn't have an implementation in MaterialX.*/ /* NOTE: This node isn't supported by MaterialX.*/
return get_output_default(socket_out_->name, NodeItem::Type::Any); return get_output_default(socket_out_->name, NodeItem::Type::Any);
} }
#endif #endif

View File

@ -25,7 +25,7 @@ static int node_shader_gpu_point_info(GPUMaterial *mat,
NODE_SHADER_MATERIALX_BEGIN NODE_SHADER_MATERIALX_BEGIN
#ifdef WITH_MATERIALX #ifdef WITH_MATERIALX
{ {
/* NOTE: This node doesn't have an implementation in MaterialX.*/ /* NOTE: This node isn't supported by MaterialX.*/
return get_output_default(socket_out_->name, NodeItem::Type::Any); return get_output_default(socket_out_->name, NodeItem::Type::Any);
} }
#endif #endif

View File

@ -74,7 +74,7 @@ static int node_shader_gpu_tex_coord(GPUMaterial *mat,
NODE_SHADER_MATERIALX_BEGIN NODE_SHADER_MATERIALX_BEGIN
#ifdef WITH_MATERIALX #ifdef WITH_MATERIALX
{ {
/* NOTE: Some outputs don't have an implementation in MaterialX.*/ /* NOTE: Some outputs aren't supported by MaterialX.*/
NodeItem res = empty(); NodeItem res = empty();
std::string name = socket_out_->name; std::string name = socket_out_->name;

View File

@ -260,6 +260,7 @@ static void sh_node_noise_build_multi_function(NodeMultiFunctionBuilder &builder
NODE_SHADER_MATERIALX_BEGIN NODE_SHADER_MATERIALX_BEGIN
#ifdef WITH_MATERIALX #ifdef WITH_MATERIALX
{ {
/* NOTE: Some inputs aren't supported by MaterialX.*/
NodeItem scale = get_input_value("Scale", NodeItem::Type::Float); NodeItem scale = get_input_value("Scale", NodeItem::Type::Float);
NodeItem detail = get_input_default("Detail", NodeItem::Type::Float); NodeItem detail = get_input_default("Detail", NodeItem::Type::Float);
NodeItem lacunarity = get_input_value("Lacunarity", NodeItem::Type::Float); NodeItem lacunarity = get_input_value("Lacunarity", NodeItem::Type::Float);

View File

@ -43,7 +43,7 @@ static int node_shader_gpu_wireframe(GPUMaterial *mat,
NODE_SHADER_MATERIALX_BEGIN NODE_SHADER_MATERIALX_BEGIN
#ifdef WITH_MATERIALX #ifdef WITH_MATERIALX
{ {
/* NOTE: This node doesn't have an implementation in MaterialX.*/ /* NOTE: This node isn't supported by MaterialX.*/
return get_output_default(socket_out_->name, NodeItem::Type::Float); return get_output_default(socket_out_->name, NodeItem::Type::Float);
} }
#endif #endif