• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

P3D v5 Blender2P3D/FSX

Hi everyone,

I've been trying for several days now to bake several textures (Specular Material) into one texture, just to regroup my textures...!

I've created a new texture used in a new texture node image, and created a new UV Map linked to this new texture... The problem is that, systematically, my new "Diffuse" texture is black...!!!!

If someone could help me on this subject, it would be greatly thanked...!
 

dave hoeffgen

Resource contributor
Hi everyone,

I've been trying for several days now to bake several textures (Specular Material) into one texture, just to regroup my textures...!

I've created a new texture used in a new texture node image, and created a new UV Map linked to this new texture... The problem is that, systematically, my new "Diffuse" texture is black...!!!!

If someone could help me on this subject, it would be greatly thanked...!

Did you make sure the new texture node is selected in all materials you want to bake from? Also the new UV map does not need to be linked within the node tree but be the active one in the object data panel.
 
Did you make sure the new texture node is selected in all materials you want to bake from? Also the new UV map does not need to be linked within the node tree but be the active one in the object data panel.

Hi Dave,

To simplify things by understanding how to make the "bake" work, I have, for the moment, only one texture to bake in another one...: it becomes black...!
And, my new texture node is selected in Shader Editor, and my new UV map is active...!
 
Last edited:

dave hoeffgen

Resource contributor
Hi Dave,

To simplify things by understanding how to make the "bake" work, I have, for the moment, only one texture to bake in another one...: it becomes black...!
And, my new texture node is selected in Shader Editor, and my new UV map is active...!

Could you show a screenshot of how the node tree and bake setup looks?

Also there is this node based baking tool which might make the baking workflow much esier:
 
Here's the screenshot..:

Blender.jpg
 

dave hoeffgen

Resource contributor
Here's the screenshot..:

View attachment 60288
Sorry, I could have thought of that earlier :banghead:
The specular shader is not compatible with cycles, that's why you end up with a black image.
You'll need a different shader, if you mean to only use the diffuse texture slot you should be fine with a diffuse shader for baking.
Also you are not tied to the node tree generated by the toolset when using it for baking.
 
I just found out this... :

1.- In the Shader Editor, I add a "Principled BSDF" shader to replace the "Specular" shader that comes standard when you select "Specular Mode" in P3D/FSX's Material Mode...
2.- I link my textures as on the image below, and I can now "bake" my texture without any problem...!

So I think the Blender2P3D/FSX tool should be fixed accordingly...!

Blender [ESimulationProjet de modelisationProjet Venom DH-112Blend ProjectVenom DH-112 VC- 004...jpg


I also specify that the inversion factor of the Alpha channel must be set to 0 ("Invert")...!
 
Last edited:

Vitus

Resource contributor
So I think the Blender2P3D/FSX tool should be fixed accordingly...!
The purpose of the Blender2P3D/FSX tool is to provide export functionality for P3D and FSX. If you want to do shader-wizardry to bake your textures, that falls outside of the scope of the tool.

One thing you need to keep in mind: while the exporter is very forgiving when it comes to the shader graph, what it strictly doesn't like is when you replace the base node. If you select "PBR" as your material mode, you're stuck to use the BSDF Principled shader node. When you're using Specular, you have to use the Specular node. The export will most likely fail if that's not the case.

I tried to get specular material to work with the BSDF Principled shader, but it's just not feasible. The shader doesn't provide the right inputs for it. If you look closely, you'll notice that the "specular" input of the BSDF is a float. Not a Color, a float. So if you want to give your specularity a differnt hue, that's not possible with the bsdf. I tried to find a way around this and consulted people on blenderartists.org, but the advise I got was to use the specular node to have full control over the specularity.

I can't remember what the reason for the inverted alpha was, but I think you're right, that looks a bit out of place. I'll look into that.
 
Hi @Vitus,

You're right, you're right. Impossible to export... : I went a little too fast!!

So I think that to make a "bake", which seems to be more than useful in modeling, you have to go through another way, for example using only PBR texturing,... except for special cases.

All this still needs some more tests, but it is obvious that to bake textures in a single texture is a necessity!
 

Vitus

Resource contributor
Yes, but I would think that this is part of the modelling workflow.

Let's say you want to create an aircraft both for P3D and FSX. The way I'd approach this nowadays would be to create a fully PBR model and once it's done bake some diffuse maps from the PBR materials, as best as I can. Once it's done I copy the model and set up a new specular material for each object in the scene, assigning the baked textures.

I don't quite understand why you want the Blender2P3D/FSX addon to create materials. Like I said: if you have some cool ideas of how to use the Blender shaders to achieve a cool effect which you want to bake into some P3D/FSX textures, you can do so. It's just that before exporting you need to switch the material mode back into either PBR or Specular and use the shader node tree that was optimize for a P3D/FSX export :wizard:
 
I don't quite understand why you want the Blender2P3D/FSX addon to create materials.
I just thought it might save me some time...! :p;)

But I understand the problem, and I think that your idea of creating a model beforehand, just to create the necessary textures, seems good to me...!

Thank you for your great work @Vitus...!
 
I've gotten this once or twice before. The fix is usually to click "Initialize the SDK" again. Sometimes quitting Blender and restarting helps as well.

Hi Bill, sorry to bother you again, but it still doesn´t work. I must have initialized the SDK a hundred times now and restarted Blender numerous times, but it just doesn´t work. The x file is created, but the mdl file isn´t. I even tried to reinstall the old version of the Blender2P3D toolset as well as the older SDK of Prepar3d v5 (before Hotfix 2) on my new Laptop but to no avail. I´m beginning to think it´s either something with my new laptop or something with Blender 2.83 which isn´t quite right. I also think the error message has changed slightly. Here is what I´m getting now:

Traceback (most recent call last):
File "C:\Users\Fabia\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\Blender2P3DFSX\func_export.py", line 345, in Export
spawnv(P_WAIT, XToMdl, ['XToMdl.exe', '"%s"' % (Util.ReplaceFileNameExt(self.config.filepath, '.x'))])
FileNotFoundError: [Errno 2] No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\Fabia\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\Blender2P3DFSX\ui_export.py", line 192, in execute
Exporter.Export()
File "C:\Users\Fabia\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\Blender2P3DFSX\func_export.py", line 351, in Export
raise ExportError("Export to .MDL failed. XToMdl.exe returned an error.")
Blender2P3DFSX.li_export.ExportError: Export to .MDL failed. XToMdl.exe returned an error.

location: <unknown location>:-1

I think the exporter either doesn´t find my Xtomdl.exe or Xtomdl.exe doesn´t find my .x file. Either way I´m about to give up on this soon after hours of installing, deleting, reinstalling and reinitializing. Is there any way to work with the x file that the toolset generates? Are there other ways to convert it into a mdl to get my models into the simulator?

Thanks, Fabian
 

Vitus

Resource contributor
Fabian,
I think one angle of attack would be to export your scene part by part and see at which point it stops working. So instead of exporting everything, select one or some of your objects and export with "selected objects" active. If the export succeeds, hide those parts (H) and then select the next bunch until you get your error message.
My guess is that it's either to do with some material not properly set up, or that a part or material has a non-English character in it, which the xenophobe XtoMDL exporter doesn't like :)

Is there any way to work with the x file that the toolset generates? Are there other ways to convert it into a mdl to get my models into the simulator?
Sure. You could export the model into collada and then import it into MCX and export from there. But to be honest, I would rather find out what causes the problem in the first place to avoid it in the future.

FYI: You could manually drag&drop the .x file generated by the Blender addon to the XtoMDL.exe program, located in the SDK directory somewhere. However, this will most likely fail just the same. The Blender2P3DFSX exporter first generates an .x file and .xanim file, according to the specs of FSX/P3D - depending on which SDK you selected. If you have the .MDL option enabled in the exporter dialog, it will call MS' XtoMDL.exe, which converts the X file to the MDL. So if there's a problem in that exact step, a manual drag&drop won't change anything.
 
Thanks for getting back to me. The problem is that the mdl export fails even on a test cube object with a single diffuse texture on it, no complex scenes whatsoever. I even took a texture without any capitals, special characters or anything (the texture is called "metal.jpg" - even xenophobes should be able to deal with that ;-) ) And as I said before, the x file is created without problems, only the mdl conversion fails. THe next thing that puzzles me is that on my old laptop the exact same object exports without problems and the mdl file is created. I literally placed my old and my new laptop next to each other and did the exact same steps on the old one with Blender 2.82 and toolset version 0.98.01 and the new one with Blender 2.83.2 and toolset v 0.98.21. Old one good, new one bad. I´ll try yet again and report back. You mentioned that maybe the material is not set up correctly - to be honest I´m only slowly learning what those dozens of settings mean so I tend to leave everything by default at first. Is that the problem? Do I need to change the default properties to make things work? And while I´m at it, does the new toolset require all texture slots to be filled? On my old laptop my models only had diffuse and normal maps, no specular or emmisive maps. For my test I just assigned a single diffuse texture, no normals, no specular ans so on. This approach worked with the old toolset, but maybe the new one has different requirements?

On another note, could I maybe send you the blend file to see if it compiles correctly on your system? I´m using the P3D V5 Hotfix 2 SDK
 
Last edited:

Vitus

Resource contributor
That's really odd. could you maybe attach the .x of your cube here? Maybe we can find something in there.
 

Vitus

Resource contributor
The .x file looks ok to me and it exports to mdl without any issues.

FileNotFoundError: [Errno 2] No such file or directory
This would indicate that one of the paths, either to the XToMDL.exe, or the one to your model file, doesn't sit well. But apart from a crooked sdk installation, or some issues with file and folder names, I really don't know what it could be.
Maybe as another test you could try converting the file manually using XToMDL.exe. Locate the program in the SDK installation and then drag & drop your .x file onto it. It should leave an MDL in the folder of your .x file.
 
Nope, didn´t work either. I see multiple xtomdl.exe files inm different folder called 3dsmax17, 3dsmax20 and so on and a "common" folder. Neither of the xtomdl files gives me a mdl file when I pull my test.x file onto it. I only see a command window appear for a fraction of a second but nothing else happens. I can´t read what´s in the window because it closes immediately after opening. The SDK is a fresh, clean install from the Prepar3d website on a completely fresh Windows 10 install into the default folder.
 

Vitus

Resource contributor
If you want to read the output of the xtomdl, you could either:
1. in blender, open the system console, export your cube and look at the output in the console
2. open a command window, navigate to the xtomdl exe and manually start passing all the right parameters
3. create a .bat file that calls the xtomdl without closing the window. A crude example:
Code:
"%~dp0/XToMDL.exe" /xanim /dict:"%~dp0../../bin/modeldef.xml" %1
pause
You'd need to adjust for your relative paths to the modeldef.xml file. But something like this would allow you to drag&drop onto the batch file and the command window will stay open after calling the exe.

The good news is that it doesn't seem to be Blender or the addon that's at fault. It might be a corrupt modeldef.xml or maybe there's still some funky characters in the path to either of those files?
 
OK the mystery continues: I copied the x file of my test cube to my old laptop and dragged it over the xtomdl.exe that resides in my P3D V5 SDK there (which is a slightly older version of the SDK, before Hotfix 2, than is installed on my new Laptop. Surprisingly, XtoMdl created a .mdl file of my x file without problems. Now I copied the whole SDK from my old to my new Laptop, dragged the exact same x file onto the exact same XtoMdl.exe and.... nothing. No mdl file. So the exact same approach works on my old system but not on my new one. So that leaves only two possibilites:

1. The xtomdl.exe of the latest version of the V5 SDK is corrupted and doesn´t work, and the older one that works on my old laptop doesn´t work on my new one because it was just copied over but not correctly installed. Unfortunately, I don´t have the original SDK installer (P3D SDK V5.024) anymore so I cannot make a clean install of the older SDK on my new laptop

2. Something is actively preventing XtoMDL to work on my new Laptop. I thought it might be a Virus Scanner so I turned that off for a moment, but still no luck. Could it be some WIndows 10 Security restrictions oder User Account settings that prevent XtoMDL from running?
 
Top