UE4 crashing on importing mdl file (i’ve got same crash on latest sources from git):
Assertion failed: Inputs[0].ExpressionData.Expression->IsA<UMaterialExpressionScalarParameter>() && (MDLType.get_kind() == mi::neuraylib::IType::TK_INT) [File:D:/Build/++UE4/Sync/Engine/Plugins/Enterprise/MDLImporter/Source/MDLImporter/Private/generator/MaterialExpressionFactory.cpp] [Line: 266]
MDL context:
export material add_top_coat(
material base = material(),
uniform bool surface_top_coat_enable = true,
uniform bool backface_top_coat_enable = false,
color top_coat_color = color(1.),
float top_coat_weight = 1.0,
float top_coat_roughness = 0.0,
uniform int top_coat_color_transmit_enable = 0,
uniform top_coat_weighting top_coat_layer_mode = tcw_principled_specular,
//Fresnel Curve
float top_coat_fresnel_curve_ior = 1.5,
//Custom Curve
float top_coat_custom_curve_normal = 0.04,
float top_coat_custom_curve_grazing = 1.0,
float top_coat_custom_curve_exponent = 5.0,
//PBR Specular Curve
float top_coat_curve_strength = 0.04,
//Directional color
uniform bool top_coat_directional_color_enable = false,
color top_coat_directional_normal_color = color(1.),
color top_coat_directional_grazing_color = color(1.),
//Anisotropy
uniform bool top_coat_anisotropy_enable = true,
float top_coat_anisotropy = 0,
float top_coat_anisotropy_rotation = 0,
float3 top_coat_bump = state::normal(),
uniform distribution_function_mode df_mode = dfm_glossy
) = let {
base::anisotropy_return top_coat_aniso = base::anisotropy_conversion(
roughness: top_coat_roughness,
anisotropy: top_coat_anisotropy_enable ? top_coat_anisotropy : 0,
anisotropy_rotation: top_coat_anisotropy_enable ? top_coat_anisotropy_rotation : 0
);
uniform bool top_coat_color_is_scatter_and_transmit_enabled = is_scatter_and_transmit_enabled(top_coat_color_transmit_enable);
base::texture_return calc_top_coat_val = top_coat_color_is_scatter_and_transmit_enabled ?
transmit_color_calc( top_coat_color, top_coat_weight, is_scatter_and_transmit_intensity(top_coat_color_transmit_enable) ) : base::texture_return();
color glossy_bsdf_tint = top_coat_color_is_scatter_and_transmit_enabled ? calc_top_coat_val.tint : top_coat_color;
float glossy_bsdf_weight = top_coat_color_is_scatter_and_transmit_enabled ? calc_top_coat_val.mono : top_coat_weight;
bsdf base_glossy = choose_bsdf(
df_mode : df_mode,
mode: df::scatter_reflect,
tint: glossy_bsdf_tint,
roughness_u: top_coat_aniso.roughness_u,
roughness_v: top_coat_aniso.roughness_v,
tangent_u: top_coat_aniso.tangent_u
).surface.scattering;
bsdf full_glossy = top_coat_directional_color_enable ? df::directional_factor(
normal_tint: top_coat_directional_normal_color,
grazing_tint: top_coat_directional_grazing_color,
exponent: (top_coat_layer_mode==tcw_principled_specular) ? 5.f : top_coat_custom_curve_exponent,
base: base_glossy
) : base_glossy;
bsdf surface_top_coat_coating = surface_top_coat_enable ?
(
( top_coat_layer_mode==tcw_principled_specular || top_coat_layer_mode==tcw_custom_curve )?
df::custom_curve_layer(
normal_reflectivity: (top_coat_layer_mode==tcw_principled_specular) ?
(top_coat_curve_strength)
: top_coat_custom_curve_normal,
grazing_reflectivity: (top_coat_layer_mode==tcw_principled_specular) ? 1.f : top_coat_custom_curve_grazing,
exponent: (top_coat_layer_mode==tcw_principled_specular) ? 5.f : top_coat_custom_curve_exponent,
weight: glossy_bsdf_weight,
layer: full_glossy,
base: base.surface.scattering,
normal: top_coat_bump
)
:
(
( top_coat_layer_mode==tcw_fresnel ) ?
df::fresnel_layer(
ior: color(top_coat_fresnel_curve_ior),
weight: glossy_bsdf_weight,
layer: full_glossy,
base: base.surface.scattering,
normal: top_coat_bump
)
:
df::weighted_layer(
weight: glossy_bsdf_weight,
layer: full_glossy,
base: base.surface.scattering,
normal: top_coat_bump
)
)
)
: bsdf();
bsdf backface_top_coat_coating = backface_top_coat_enable ?
(
( top_coat_layer_mode==tcw_principled_specular || top_coat_layer_mode==tcw_custom_curve )?
df::custom_curve_layer(
normal_reflectivity: (top_coat_layer_mode==tcw_principled_specular) ?
(top_coat_curve_strength)
: top_coat_custom_curve_normal,
grazing_reflectivity: (top_coat_layer_mode==tcw_principled_specular) ? 1.f : top_coat_custom_curve_grazing,
exponent: (top_coat_layer_mode==tcw_principled_specular) ? 5.f : top_coat_custom_curve_exponent,
weight: glossy_bsdf_weight,
layer: full_glossy,
base: base.backface.scattering,
normal: top_coat_bump
)
:
(
( top_coat_layer_mode==tcw_fresnel ) ?
df::fresnel_layer(
ior: color(top_coat_fresnel_curve_ior),
weight: glossy_bsdf_weight,
layer: full_glossy,
base: base.backface.scattering,
normal: top_coat_bump
)
:
df::weighted_layer(
weight: glossy_bsdf_weight,
layer: full_glossy,
base: base.backface.scattering,
normal: top_coat_bump
)
)
)
: bsdf();
} in
material(
thin_walled: base.thin_walled,
surface : surface_top_coat_enable ?
material_surface(
emission : base.surface.emission,
scattering : surface_top_coat_coating
)
:
base.surface,
backface : backface_top_coat_enable ?
material_surface(
emission : base.backface.emission,
scattering : backface_top_coat_coating
)
:
base.backface,
ior: base.ior,
volume : base.volume,
geometry : base.geometry
);