When Exporting from Blender 4.2.6 LTS, all materials have AlphaMode set to “BLEND”. When loaded in-sim, all parts exhibit artificing (Z-buffer fighting).
Repro steps:
Export a model from Blender 4.2. or 4.5 LTS using the provided 3.3.1 plugin.
When loaded in-sim, all parts exhibit artificing (Z-buffer fighting).
If the “alphaMode”: “BLEND” is manually replaced with “alphaMode”: “OPAQUE” within the GlTF file, the model now renders correctly (except materials supposed to be transparent).
This issue is not present when exporting via Blender 3.6 LTS with the same 3.3.1 exporter.
I tried creating some very simple blender files with only one material and an albedo texture. Scenarios tested:
File created in Blender 3.6: exported material has “alphaMode”: “OPAQUE”. OK!
Same File imported and saved in Blender 3.6: exported material has “alphaMode”: “BLEND”.
File created in Blender 4.2: exported material has “alphaMode”: “BLEND”.
Modifying the shader tree and removing the link to the Principled BSDF alpha solves this. Not that this connection is present in 3.6.
I can confirm this. Blender 4.2 no longer has a Blend_Mode as the core data variable, It relies on a complex algorithm for alpha, color attributes, textures and factors. It defaults to BLEND.
see gather_alpha_info
in Blender gltf2_blender_search_node_tree.py
EDIT:
reference - will not be changed in Blender Khronos
Temp fix if you know python and can edit files. (Use at your own risk) - no need to mod for Blender 3.6
ASOBO msfs_export.py
mod
def gather_material_hook(
self,
gltf2_material,
blender_material,
export_settings
):
if not self.properties.enable_msfs_extension:
return
# late 4.2 change alphamode always set to BLEND
# blender 4.2 June 6 beta - there is no longer a Blender Blend_mode variable - this was used to set the gltf alphaMode json
# variable - since ASOBO now controls the msfs_alpha_mode - we must push this setting to the gltf and bypass the Khronos code - settings to BLEND
# this BLEND setting causes the sim flickering of all textures. - what a mess
#print("*** MSFS WARNING *** - alpha mode mat",blender_material.msfs_material_type, blender_material.msfs_alpha_mode, gltf2_material.alpha_mode)
if blender_material.msfs_alpha_mode != gltf2_material.alpha_mode and gltf2_material.alpha_mode is not None:
if blender_material.msfs_alpha_mode == "OPAQUE":
before_gltf_alpha_mode = gltf2_material.alpha_mode
if gltf2_material.alpha_mode != None:
gltf2_material.alpha_mode = None
print("*** MSFS WARNING *** - Force Khronos alpha mode changed to Opaque/None",blender_material.msfs_material_type, blender_material.name, blender_material.msfs_alpha_mode, gltf2_material.alpha_mode, "gltf alpha mode was", before_gltf_alpha_mode)
else:
gltf2_material.alpha_mode = blender_material.msfs_alpha_mode
print("*** MSFS WARNING *** - Force Khrons alpha mode changed",blender_material.msfs_material_type, blender_material.name, blender_material.msfs_alpha_mode, gltf2_material.alpha_mode)
MSFS2020_Material_IO.export(
gltf2_material,
blender_material,
export_settings
)
if "KHR_materials_clearcoat" in gltf2_material.extensions:
gltf2_material.extensions.pop("KHR_materials_clearcoat", None)
if "KHR_materials_anisotropy" in gltf2_material.extensions:
gltf2_material.extensions.pop("KHR_materials_anisotropy", None)
I have also found out that vertex colors may not export, for instance if you are only using vertex alpha to tune detail map intensity (great for subtle variation or wear).
And, there is a python edit applicable (msfs_multi_export_settings.py):
export_vertex_color: bpy.props.EnumProperty(
name="Use Vertex Color",
items=(
(
'ACTIVE',
'Active',
"Export Active vertex color in the Mesh"
),
(
'MATERIAL',
'Material',
"Export vertex color when used by material"
),
(
'NONE',
'None',
"Do not export vertex color"
)
),
description="How to export vertex color",
default='ACTIVE'
)
The “Active” option was missing. This apparently simply exports the vertex color as present in the mesh, no fancy checks (that often fail, or overwrite it with a fake)
Now I can merrily go on using Blender 4.2 /4.5 (I use 4.2 for 2020, and 4.5 for 2024 so I do not forget to swich plug-ins, which can result in a lot of trouble with materials)