plane icon Welcome to Microsoft Flight Simulator’s SDK Q&A Platform!

You have questions regarding the SDK? DevMode Tools? SimConnect? You would like to submit an idea for future improvements, seek help or exchange knowledge? You’re in the right place.


Please take a moment to read the platform’s guidelines before you get started!


question

RomanDesign avatar image
RomanDesign asked RomanDesign commented

MSFS Blender materials ignoring roughness/metallness (ORM) information. I need a way to re-use materials. Any ideas?

I'm having a problem with my materials - many of them are ignoring the ORM composite image data, i.e. roughness and metallness, when used from Asset Browser or linked in any way. If I create a new material and import 3 images (Diffuse, ORM, Normal) it's working in MSFS. However if a material is taken from the Blender 3.1.0 Asset Library, or taken from the object pasted form another file, or migrated with a new Asobo Exporter addon, it seems that the roughness is ignored, material looks dull and not shiny. However a new material from the same images looks great. I'm using Asobo Exporter (latest version) and Blender 3.1.0

I need a working way to re-use materials instead of having to create them every time for every Blender file.

See the screengrab from MSFS: the orange paint in the right shape is from the library and is dull, and the new material (lower left) based on the same images and in every way identical, is shiny and textured. They are exactly the same, except from one is fresh, and another is from the Asset Library. Yellow paint (upper left) is also dull - it's taken from Assett Library (migrated to Asobo Explorer in the library file).



1666991042831.png


I was using Blender2MSFS before, and I noticed a similar problems. Now it's back wiht a vengeance in the Asobo Exporter. Sometimes just reopening images in a material seems to help. I compared nodes and the yellow and orange paint have a slightly different node that splits the ORM (Occlusion/Roughness/Metalness) composite image:


This is the migrated MSFS material:


1666991041043.png



And this is the newly created material:

1666991041468.png

First has the red node with "color" input, and the second had blue node with "image" input. They are otherwise identical. I tried to manually replace the red nodes with blue nodes - which I used for orange paint material on the right of the image, hoping that it would fix the possible migration error, but it stays dull, although it does fix its appearance in Blender (in Shading view). Both are equally shiny in Blender. But not in MSFS.

Also, see the blue paint material, based on same images except for the blue diffusion image: again, it looks correct in the MSFS material properties of Asobo Exporter, but it's dull in Blender and MSFS.

After I manually replace the node with the "image" input one in Blender material, it looks shiny in Blender:
1666991041337.png

But when I export, then Build project in MSFS, then close the project and reopen and load in the Project Editor, the blue material is still dull in MSFS. However newly created orange that seems the same in shader editor is perfectly shiny (left half of the flower), while the migrated yellow from the Asset library (on the right) is also dull.


1666991042512.png

So manually replacing the node with the shader editor fixes the look in Blender, but not in exported MSFS material.


I have many dozens of materials, it's not feasible to created them from scratch for every model. I need to use them from the Asset Library (or pasted from other files, like I did before Asset Browser was implemented in Blender). But I don't know what else to do... All advice appreciated...

materialsblender
1666991041043.png (127.9 KiB)
1666991041468.png (191.4 KiB)
1666991041337.png (95.3 KiB)
1666991042831.png (2.7 MiB)
1666991042512.png (2.2 MiB)
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

DA40CGDFQ avatar image
DA40CGDFQ answered RomanDesign edited

This is all due to a breaking change in Blender as you have found out. The new comp node is an image node with R G B output. The ASOBO exporter and the Vitus legacy exporter are looking for the old Separate Red Green Blue node. So you must stay at blender 3.1.0. Once you go to blender 3.3 this breaking change affects all MSFS exporters. If you have saved your blend file from 3.3 you will have to delete and redo all your materials. ( I believe most of the values stay for factors and values etc.) but you will need to check them all. It's very difficult to go back from 3.3 to 3.1. Not even sure file Append will work.


A note to all stay on blender 3.1.0 and the legacy exporter.


It seems you built this in blender 3.3 and are now going back to 3.1? correct?


4 comments
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

RomanDesign avatar image RomanDesign commented ·
The file used in Asset Library was built in 2.8+ but worked on 3.3 and resaved, and the current project was started in 3.3

Just replacing the node doesn't work in MSFS (but it fixes the look within Blender!), and even creating a new material in Asset Library and using it in my project file doesn't work (see my reply below). It seems that only a completely new material works, not even new material via Asset Library. I wonder what could ne the issue that I could correct instead of recreating every single new material for every new object every time, which is insane...

0 Likes 0 ·
RomanDesign avatar image RomanDesign commented ·
Also, I'm using Blender 3.1.0 and if I create a new material, it uses the blue node with Image input, not the red node...Same happens if I open an old file (made in v2.82) and migrate material via button in new Exported - I get "image" splitter node.
0 Likes 0 ·
DA40CGDFQ avatar image DA40CGDFQ RomanDesign commented ·
The legacy exporter named it's nodes in a specific way. You will see the shader screen is quite different between ASOBO and legacy exporter. We decided to add a legacy to ASOBO migrate button to help with the people that had older projects and wanted to use the ASOBO exporter. The migrator is good but it is not perfect. You must double check it did the migration to your satisfaction.
0 Likes 0 ·
RomanDesign avatar image RomanDesign DA40CGDFQ commented ·

The actual migration is actually good, it's not at fault, this problem is happening with new materials too, if they are created in a separate Asset Library file and are used through the Asset Browser. I tried all 3 options - linking and both appending options, but all materials always lose ORM appearance despite looking perfectly fine in the MSFS pane in Blender. Everything seems to be linked, but just isn't showing up in MSFS. I had the same exact problem long ago, with Legacy exporter and Blender 2.85 - as long as the material is freshly created in the same Blender file it was working, but if the object is it's pasted/appended from another file, its materials lost ORM appearance, on those objects or any others. This is the same or very similar problem, happening with Asset browser, but also when pasting/appending objects from other files, only now with new Eporter and Blender 3.1

0 Likes 0 ·
RomanDesign avatar image
RomanDesign answered RomanDesign commented

I just tested by creating a new material in Asset Library and using it from there VS creating a new material inside the Blender file. It only works within the Blender file! Every time a material is used from Asset Library or possibly via copy-paste (not tested yet with the new Exporter) the ORM is ignored despite being present in the settings. The same bug was there with Blender2MSFS Exporter but it was occasionally fixed by reloading images... Something must be differen in how materials are exported based on whether material is new or pasted/linked from Asset Library or other file.

11 comments
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

DA40CGDFQ avatar image DA40CGDFQ commented ·

Are you manipulating any values for nodes in the node shader window? If so do not do this, as the values may not be transferred back to the Material panel. Only manipulate the values from the MSFS panel. Also do not change any values in the Surface panel. Again they don't get reflected in variables that are used in the export.


If you do manipulate any shader node values double check that those values are seen in the MSFS material pane.

Is this your own asset library you made. Or is is from a downloaded source?


My git has a test fork of ASOBO exporter using blender 3.3 - feel free to test if you like.
https://github.com/ronh991/glTF-Blender-IO-MSFS/tree/Blender-3.3-comp-node-rename


0 Likes 0 ·
RomanDesign avatar image RomanDesign DA40CGDFQ commented ·
I tried manipulating the nodes as a powwible workaround, but it doesn't work. Whatever I do in the MSFS material pane doesn't help. New material has ORM working, but the material from Asset Library doesn't. Yes, I created the Asset Library and all materials from scratch.
0 Likes 0 ·
RomanDesign avatar image RomanDesign DA40CGDFQ commented ·
And thank you for the git, I'll check it out. Can you investigate what can be happening with Asset Library materials? Something is not transferring to the MSFS pane correctly, and although it looks right, the roughness and metallic (and most likely occlusion) do not transfer to MSFS.
0 Likes 0 ·
DA40CGDFQ avatar image DA40CGDFQ RomanDesign commented ·
I am not to familiar with asset libraries. Is this a model lib file added to a scenery project. Can you give me a simple step by step you use to create an asset lib? Just so I am reproducing your issue.
0 Likes 0 ·
Show more comments
RomanDesign avatar image RomanDesign DA40CGDFQ commented ·

I tried your GIT fork in Blender 3.3 but get an error upon exporting, related to displacement:

1667063950619.png

0 Likes 0 ·
1667063950619.png (36.5 KiB)
DA40CGDFQ avatar image DA40CGDFQ RomanDesign commented ·

oops I forgot to push that fix. look at ASOBO issues if you know how to edit python code.


https://github.com/AsoboStudio/glTF-Blender-IO-MSFS/issues/164#issuecomment-1284697169

0 Likes 0 ·
Show more comments
WombiiActual avatar image
WombiiActual answered WombiiActual commented

Sometimes when copying between files the gltf settings node is duplicated which causes the sim to not use the comp texture. Setting it back to the original makes the material work again. Could be worth checking. 1667058234906.png


1667058234906.png (63.1 KiB)
3 comments
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

RomanDesign avatar image RomanDesign commented ·

That is extremely interesting! Yes, you are correct, I checked materials dropped from Asset Browser and they default to duplicated settings:

1667059900836.png

I will test with MSFS. If indeed this is what's preventing the exporter from exporting comp data correctly, this is a huge find! I will report back after testing.

0 Likes 0 ·
1667059900836.png (33.4 KiB)
RomanDesign avatar image RomanDesign commented ·
Unfortunately that doesn't seem to work. comp texture is still MIA after I reset this to the first settings in several materials.
0 Likes 0 ·
WombiiActual avatar image WombiiActual RomanDesign commented ·
Too bad. That's the fix that works for me when I have those symptoms. Hopefully you'll find your cause!
0 Likes 0 ·
RomanDesign avatar image
RomanDesign answered RomanDesign commented

I think I now have a workaround! For anyone stuck this could be valuable - I wasted 2 days trying to overcome this problem. Turns out there are 2 separate issues:

1. The new Exporter presents a button "Migrate Material" when the material was originally done in a legacy exporter. The material that's created after that looks OK on the first glance, but if the same material is created from scratch you can see a difference in the RGB splitter node.

This is the migrated MSFS material, it has "Color" as input in the splitter node:


1666991041043.png



And this is the newly created material, it has "image" input in a splitter node:

1666991041468.png


I can copy this node from a fresh material and paste into the broken material, and reconnect the nodes in the same way. This fixes how the material looks inside blender. However this still doesn't fix the export, comp texture is still missing in MSFS.

2. After dropping the material from Asset Browser into your current project file, I have to revisit the shader tree and check that the gTLF settings has not created a new setting, and if it did to revert it to the first original settings:



This is the object dropped from the Asset Library with its materials with the first step done, but not the second one:

1667072579154.png

After those 2 steps are both done, the exported result has comp texture working correctly:

1667072668731.png


1667071349471.png


1667071349471.png (1.2 MiB)
1667072579154.png (1.6 MiB)
1667072668731.png (1.4 MiB)
2 comments
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

DA40CGDFQ avatar image DA40CGDFQ commented ·

This is excellent - appreciate the work you did on tracking this down. This information should be added to the ASOBO Blender exporter readme. @EPellissier @FlyingRaccoon

0 Likes 0 ·
RomanDesign avatar image RomanDesign DA40CGDFQ commented ·
I think this should not be difficult to fix. Maybe those two specific problems can be taken care of by whoever's working on the code? The incorrect node should be replaced by a correct one, and maybe there's a way to prevent the creation of gTLF setting with ".00x" tails? That would be the best solution. My manual fix of those 2 things is time-consuming when I have a large material library. But it's easy enough if this is done while converting specific materials for the first time.
1 Like 1 ·
lyonhaart001 avatar image
lyonhaart001 answered RomanDesign commented

Thanks @RomanDesign for sharing your findings on this. I had complained to Blender about this change. But... Its good to know the Node still exists in their system and can still be used. I am going to try this on my project and see if it exports.

Bill
LHC

2 comments
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

lyonhaart001 avatar image lyonhaart001 commented ·

This didnt fix my issue on exporting. It goes into a loop.


0 Likes 0 ·
RomanDesign avatar image RomanDesign lyonhaart001 commented ·
The process I described works for me with Blender 3.1.0. One other note that the migration seems to be working OK and placing a correct node now. I think what happened with most of my materials is that I initially installed Blender 3.3 and created my Asset Library using it, so I resaved my file. And migrating materials with Blender 3.3 cause this wrong node issue. If migrating with 3.1 it doesn't happen apparently. But the gTLF setting steel has to be watched and changed if overwritten.
0 Likes 0 ·
RomanDesign avatar image
RomanDesign answered RomanDesign edited

@lyonhaart001 @WombiiActual @WombiiActual

I have spent ~4 hours with ChatGPT and finally got it to write a "fixer" script for this issue. I literally spent hours on doing it manually already, and then my whole material library file got the red nodes again somehow (from opening and saving in another Blender version? Or just for no reason?). Those were a couple of hundred materials and objects, so I decided to try ChatGPT instead of spending hours on fixing it and then possibly losing it again. Also, I had this happen in several other files, so this needed a more automated workaround.

Execute this in the file that has those nodes turned red with "Color" input and it will convert them to proper "Separate RGB" nodes with "Image" input and will reconnect it to the same places as the old ones.

It will also automatically remap extra "gITF Settings.00x" node groups to the default one and deletes unused ones.

I have to say ChatGPT is something else... It outputted a reasonable code based on my description of the problem and fixed and improved it based on my feedback until it was working fine. Took some time, but not more than explaining it to a live programmer. I don't have sufficient Python and Blender knowledge to write such a script myself. Main functionality was written in minutes, but the bulk of the time went into trying to fix the lack of connections of the new node to the same places as the old node. The ways it mapped it didn't work again and again. Until I instructed it to target specific nodes for connections, by names.

Basically, I can run this script once when my file is otherwise ready for export, and it will fix all the materials and gITF settings that bugged out during the work with the file, in one click. Now this makes it very easy. It would be still nice if this workaround wasn't needed in the first place, of course.

import bpy


# Initialize a counter for the number of instances found and replaced
count = 0


# Loop through all objects in the file
for obj in bpy.data.objects:
    # Loop through all materials in the object
    for slot in obj.material_slots:
        if slot.material:
            # Check if the material has a node tree
            if slot.material.node_tree:
                # Get the material node tree
                tree = slot.material.node_tree
                # Loop through all nodes in the tree
                for node in tree.nodes:
                    # Check if the node name contains "SplitOcclMetalRough"
                    if "SplitOcclMetalRough" in node.name:
                        # Create a new Separate RGB node
                        sep_rgb = tree.nodes.new(type="ShaderNodeSeparateRGB")
                        # Set the location of the new node
                        sep_rgb.location = node.location
                        # Copy the input connections from the old node to the new node
                        for input in node.inputs:
                            if input.name in sep_rgb.inputs:
                                for link in input.links:
                                    tree.links.new(link.from_node.outputs[0], sep_rgb.inputs[input.name])
                            else:
                                if input == node.inputs[0]:
                                    if input.links:
                                        tree.links.new(input.links[0].from_node.outputs[0], sep_rgb.inputs[0])
                                else:
                                    if input.links:
                                        tree.links.new(input.links[0].from_node.outputs[0], node.inputs[input.name])
                        # Create new output connections
                        for output in sep_rgb.outputs:
                            if output.name == "R":
                                occlusion_node = tree.nodes.get("Occlusion Multiplier")
                                if occlusion_node:
                                    tree.links.new(output, occlusion_node.inputs[1])
                            elif output.name == "G":
                                roughness_node = tree.nodes.get("Roughness Multiplier")
                                if roughness_node:
                                    tree.links.new(output, roughness_node.inputs[1])
                            elif output.name == "B":
                                metallic_node = tree.nodes.get("Metallic Multiplier")
                                if metallic_node:
                                    tree.links.new(output, metallic_node.inputs[1])
                        # Remove the old node from the tree
                        tree.nodes.remove(node)
                        # Increment the counter
                        count += 1


# Output the number of instances found and replaced in the console
print("Found and replaced", count, "instances of SplitOcclMetalRough nodes.")


# Find all node groups with "glTF Settings.00" in their name
matching_groups = [group for group in bpy.data.node_groups if "glTF Settings.00" in group.name]


# Find the "glTF Settings" node group
new_group = bpy.data.node_groups.get("glTF Settings")


# Remap users of the matching node groups to the new group
count = 0
for obj in bpy.context.scene.objects:
    if obj.type != 'MESH':
        continue
    for group in matching_groups:
        if group.users:
            group.user_remap(new_group)
            count += 1


# Print the number of node groups renamed
print("Renamed {} node groups".format(count))


# Delete unused data blocks
bpy.ops.outliner.orphans_purge()

10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

DA40CGDFQ avatar image
DA40CGDFQ answered RomanDesign commented

@RomanDesign There is also a breaking change in blender 3.3/3.4
There are breaking changes to the node for ShaderNodeSeparateRGB has changed to ShaderNodeSeparateColor. Blender 3.4 has breaking change with ShaderNodeMixRGB to ShaderNodeMix.


Edit: the Code also changes its input and output numbering. What was Color1, Color2 is A, B inputs, but that will not work you must change input (1 and 2) to (6 and 7), and then output "result" was 0 and will now be 2

Enjoy the Blender fun.

2 comments
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

tracernz avatar image tracernz commented ·
As I understand the blender exporter only supports Blender 3.3 LTS so Blender 3.4 is not a problem at this stage.
0 Likes 0 ·
RomanDesign avatar image RomanDesign tracernz commented ·
Unfortunately, it doesn't work at all for me with Blender 3.3LTS. Does it work for you? It throws an error, unless "custom properties" checkbox is deselected. See the issue I opened on GitHub
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 5 attachments (including images) can be used with a maximum of 19.1 MiB each and 23.8 MiB total.