forked from blender/blender
MaterialX: Implement more shader nodes #23
@ -40,6 +40,32 @@ static int node_shader_gpu_bsdf_refraction(GPUMaterial *mat,
|
|||||||
return GPU_stack_link(mat, node, "node_bsdf_refraction", in, out);
|
return GPU_stack_link(mat, node, "node_bsdf_refraction", in, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
|
if (to_type_ != NodeItem::Type::BSDF) {
|
||||||
|
return empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
NodeItem color = get_input_value("Color", NodeItem::Type::Color3);
|
||||||
|
NodeItem roughness = get_input_value("Roughness", NodeItem::Type::Vector2);
|
||||||
|
NodeItem ior = get_input_value("IOR", NodeItem::Type::Float);
|
||||||
|
NodeItem normal = get_input_link("Normal", NodeItem::Type::Vector3);
|
||||||
|
|
||||||
|
NodeItem res = create_node("dielectric_bsdf", NodeItem::Type::BSDF);
|
||||||
|
if (normal) {
|
||||||
|
res.set_input("normal", normal);
|
||||||
|
}
|
||||||
|
res.set_input("tint", color);
|
||||||
|
res.set_input("roughness", roughness);
|
||||||
|
res.set_input("ior", ior);
|
||||||
|
res.set_input("scatter_mode", val(std::string("T")));
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_bsdf_refraction_cc
|
} // namespace blender::nodes::node_shader_bsdf_refraction_cc
|
||||||
|
|
||||||
/* node type definition */
|
/* node type definition */
|
||||||
@ -55,6 +81,7 @@ void register_node_type_sh_bsdf_refraction()
|
|||||||
blender::bke::node_type_size_preset(&ntype, blender::bke::eNodeSizePreset::MIDDLE);
|
blender::bke::node_type_size_preset(&ntype, blender::bke::eNodeSizePreset::MIDDLE);
|
||||||
ntype.initfunc = file_ns::node_shader_init_refraction;
|
ntype.initfunc = file_ns::node_shader_init_refraction;
|
||||||
ntype.gpu_fn = file_ns::node_shader_gpu_bsdf_refraction;
|
ntype.gpu_fn = file_ns::node_shader_gpu_bsdf_refraction;
|
||||||
|
ntype.materialx_fn = file_ns::node_shader_materialx;
|
||||||
|
|
||||||
nodeRegisterType(&ntype);
|
nodeRegisterType(&ntype);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user