Merge branch 'blender-v4.4-release'

This commit is contained in:
Brecht Van Lommel
2025-02-06 14:30:15 +01:00
4 changed files with 49 additions and 35 deletions

View File

@@ -491,13 +491,10 @@ template<typename T>
/**
* Returns true if matrix has inverted handedness.
*
* \note It doesn't use determinant(mat4x4) as only the 3x3 components are needed
* when the matrix is used as a transformation to represent location/scale/rotation.
* \note It doesn't use determinant(mat4x4) as only the 3x3 components are needed assuming
* the matrix is used as a transformation to represent 3D location/scale/rotation.
*/
template<typename T, int Size> [[nodiscard]] bool is_negative(const MatBase<T, Size, Size> &mat)
{
return determinant(mat) < T(0);
}
template<typename T> [[nodiscard]] bool is_negative(const MatBase<T, 3, 3> &mat);
template<typename T> [[nodiscard]] bool is_negative(const MatBase<T, 4, 4> &mat);
/**

View File

@@ -139,13 +139,20 @@ template double determinant(const double2x2 &mat);
template double determinant(const double3x3 &mat);
template double determinant(const double4x4 &mat);
template<typename T> bool is_negative(const MatBase<T, 3, 3> &mat)
{
return determinant(mat) < T(0);
}
template<typename T> bool is_negative(const MatBase<T, 4, 4> &mat)
{
return Eigen::Map<const Eigen::Matrix<T, 3, 3>, 0, Eigen::Stride<4, 1>>(mat.base_ptr())
.determinant() < T(0);
}
template bool is_negative(const float3x3 &mat);
template bool is_negative(const float4x4 &mat);
template bool is_negative(const double3x3 &mat);
template bool is_negative(const double4x4 &mat);
/** \} */

View File

@@ -376,35 +376,41 @@ NODE_SHADER_MATERIALX_BEGIN
/* NOTE: commented inputs aren't used for node creation. */
auto bsdf_inputs = [&]() -> InputsType {
return {
{"base_color", get_input_value("Base Color", NodeItem::Type::Color3)},
{"diffuse_roughness", get_input_value("Diffuse Roughness", NodeItem::Type::Float)},
{"subsurface", get_input_value("Subsurface Weight", NodeItem::Type::Float)},
{"subsurface_scale", get_input_value("Subsurface Scale", NodeItem::Type::Float)},
{"subsurface_radius", get_input_value("Subsurface Radius", NodeItem::Type::Vector3)},
//{"subsurface_ior", get_input_value("Subsurface IOR", NodeItem::Type::Vector3)},
{"subsurface_anisotropy", get_input_value("Subsurface Anisotropy", NodeItem::Type::Float)},
{"metallic", get_input_value("Metallic", NodeItem::Type::Float)},
{"specular", get_input_value("Specular IOR Level", NodeItem::Type::Float)},
{"specular_tint", get_input_value("Specular Tint", NodeItem::Type::Color3)},
{"roughness", get_input_value("Roughness", NodeItem::Type::Float)},
{"anisotropic", get_input_value("Anisotropic", NodeItem::Type::Float)},
{"anisotropic_rotation", get_input_value("Anisotropic Rotation", NodeItem::Type::Float)},
{"sheen", get_input_value("Sheen Weight", NodeItem::Type::Float)},
{"sheen_roughness", get_input_value("Sheen Roughness", NodeItem::Type::Float)},
{"sheen_tint", get_input_value("Sheen Tint", NodeItem::Type::Color3)},
{"coat", get_input_value("Coat Weight", NodeItem::Type::Float)},
{"coat_roughness", get_input_value("Coat Roughness", NodeItem::Type::Float)},
{"coat_ior", get_input_value("Coat IOR", NodeItem::Type::Float)},
{"coat_tint", get_input_value("Coat Tint", NodeItem::Type::Color3)},
{"ior", get_input_value("IOR", NodeItem::Type::Float)},
{"transmission", get_input_value("Transmission Weight", NodeItem::Type::Float)},
{"thin_film_thickness", get_input_value("Thin Film Thickness", NodeItem::Type::Float)},
{"thin_film_IOR", get_input_value("Thin Film IOR", NodeItem::Type::Float)},
{"alpha", get_input_value("Alpha", NodeItem::Type::Float)},
{"normal", get_input_link("Normal", NodeItem::Type::Vector3)},
{"coat_normal", get_input_link("Coat Normal", NodeItem::Type::Vector3)},
{"tangent", get_input_link("Tangent", NodeItem::Type::Vector3)},
return
{
{"base_color", get_input_value("Base Color", NodeItem::Type::Color3)},
{"diffuse_roughness", get_input_value("Diffuse Roughness", NodeItem::Type::Float)},
{"subsurface", get_input_value("Subsurface Weight", NodeItem::Type::Float)},
{"subsurface_scale", get_input_value("Subsurface Scale", NodeItem::Type::Float)},
# if MATERIALX_MAJOR_VERSION <= 1 && MATERIALX_MINOR_VERSION <= 38
{"subsurface_radius", get_input_value("Subsurface Radius", NodeItem::Type::Vector3)},
# else
{"subsurface_radius", get_input_value("Subsurface Radius", NodeItem::Type::Color3)},
# endif
//{"subsurface_ior", get_input_value("Subsurface IOR", NodeItem::Type::Vector3)},
{"subsurface_anisotropy",
get_input_value("Subsurface Anisotropy", NodeItem::Type::Float)},
{"metallic", get_input_value("Metallic", NodeItem::Type::Float)},
{"specular", get_input_value("Specular IOR Level", NodeItem::Type::Float)},
{"specular_tint", get_input_value("Specular Tint", NodeItem::Type::Color3)},
{"roughness", get_input_value("Roughness", NodeItem::Type::Float)},
{"anisotropic", get_input_value("Anisotropic", NodeItem::Type::Float)},
{"anisotropic_rotation", get_input_value("Anisotropic Rotation", NodeItem::Type::Float)},
{"sheen", get_input_value("Sheen Weight", NodeItem::Type::Float)},
{"sheen_roughness", get_input_value("Sheen Roughness", NodeItem::Type::Float)},
{"sheen_tint", get_input_value("Sheen Tint", NodeItem::Type::Color3)},
{"coat", get_input_value("Coat Weight", NodeItem::Type::Float)},
{"coat_roughness", get_input_value("Coat Roughness", NodeItem::Type::Float)},
{"coat_ior", get_input_value("Coat IOR", NodeItem::Type::Float)},
{"coat_tint", get_input_value("Coat Tint", NodeItem::Type::Color3)},
{"ior", get_input_value("IOR", NodeItem::Type::Float)},
{"transmission", get_input_value("Transmission Weight", NodeItem::Type::Float)},
{"thin_film_thickness", get_input_value("Thin Film Thickness", NodeItem::Type::Float)},
{"thin_film_IOR", get_input_value("Thin Film IOR", NodeItem::Type::Float)},
{"alpha", get_input_value("Alpha", NodeItem::Type::Float)},
{"normal", get_input_link("Normal", NodeItem::Type::Vector3)},
{"coat_normal", get_input_link("Coat Normal", NodeItem::Type::Vector3)},
{"tangent", get_input_link("Tangent", NodeItem::Type::Vector3)},
};
};

View File

@@ -89,7 +89,11 @@ NODE_SHADER_MATERIALX_BEGIN
NodeItem color = get_input_value("Color", NodeItem::Type::Color3);
NodeItem scale = get_input_value("Scale", NodeItem::Type::Float);
# if MATERIALX_MAJOR_VERSION <= 1 && MATERIALX_MINOR_VERSION <= 38
NodeItem radius = get_input_value("Radius", NodeItem::Type::Vector3);
# else
NodeItem radius = get_input_value("Radius", NodeItem::Type::Color3);
# endif
NodeItem anisotropy = get_input_value("Anisotropy", NodeItem::Type::Float);
NodeItem normal = get_input_link("Normal", NodeItem::Type::Vector3);