Blender2P3D/FSX

From FSDeveloper Wiki
Revision as of 08:03, 27 March 2020 by Vitus (talk | contribs) (Material parameters)
Jump to: navigation, search



The Blender2P3D/FSX toolset is an addon for Blender. This addon is a continuation of the Blender2FSX Toolset manual and it incorporates compatibility with the latest API for Blender version 2.8x and above. The new toolset also features full support of PBR materials for Lockheed Martin's Prepar3D v4.4 and above, as well as some changes to the interface and file structure of the addon. This wiki will help you install and use the new toolset.

Installation

Requirements

  • Windows 10 or 8.x
  • Microsoft Flight Simulator X SDK including updates to SP2 or Acceleration or
  • Lockheed Martin Prepar3D SDK v2.x, v3.x, & v4.x

Setup

After downloading the addon, open Blender 2.8x and open the Preferences (Edit->Preferences). Navigate to the "Add-ons" tab and click on "Install...". In the file manager, navigate to the Blender2P3DFSX.zip file, select it and click on "Install Add-on". This will extract the content of the zip file to your Blender script folder (by default under: %APPDATA%\Blender Foundation\Blender\<version number>\scripts\addons). Next, you need to activate the addon by clicking on the check-mark next to "3DView: P3D/FSX Toolset". That should enable the addon and the various panels and properties. Close the Preferences window.

To ensure that the addon was correctly installed, press "N" on your keyboard while the mouse pointer is in one of the main viewports. This should open the main panels of the addon under the tab named "P3D/FSX".

Using the Tools

Overview

Once installed, the Blender2P3D/FSX toolset will append the list of toolkit panels in your viewport. Press "N" to open or close the list of tools. There will be a new entry named "P3D/FSX", which gives access to the tools of this addon. The different tools are organized in different panels, which are grouped by function. The addon adds object properties to the scene. These properties are for instance the references to the various SDKs you can utilize or object properties like attached animations or scenery properties. Furthermore, the addon will append the material parameters by P3D or FSX specific parameters. Lastly, the addon extends the exporter capabilities and allows you to export your scene to an x-file format and from there calls XToMdl.exe to generate a Prapar3D/Flight Simulator X compatible 3d model.

Setting up your scene

tbc...

Scenery properties

tbc...

Animations

tbc...

Attachpoints

tbc...

Material parameters

The P3D/FSX Blender toolset will extend the material properties to include flight simulator specific parameters. Make sure to carefully go through the list of properties to make sure that your material is ready for export. The most fundamental parameter is the main material mode. You can choose between "PBR Material", "Specular Material" and "Disabled". Note that any material with the mode being set to "disabled" will be skipped during the export process. Also note that the PBR material is only available for models used in Prepar3D version 4.4 or higher. Therefore, if you are preparing a model for FSX or older versions of Prepar3d, make sure to have the material mode set to Specular.

The P3D/FSX Blender toolset is making use of Blender's shader graph and as a result it is important that your materials comply with the conventions of the addon's exporter. Whenever you change between different material modes, a script will automatically replace the current shader graph with one that is compatible with the chosen material mode. This means that currently you will have to re-assign all textures every time you change the material mode!

The exporter will run an analysis on all materials to extract the texture information. This is done in two ways, by checking what texture nodes connect to the relevant input nodes and by looking for specific node names. This way, it is possible to modify the shader graph in Blender while retaining the ability to export the materials properly. The texture paths are searched for in the following manner: 1. check the relevant input socket of the BSDF Principled shader node 2. follow all the links from that node and create a list of texture image nodes 3. if there are more than one texture image nodes directly or indirectly connected to the input socket, check the name of both and see if it matches 4. if there are NO texture image nodes connected to the input socket, search through ALL the texture image nodes of the graph, check if the name matches.

On creation of the shader graph, the texture image nodes will be given their corresponding names. Those are: "diffuse" for the diffuse/albedo texture "specular" for the specular texture "metallic" for the metallic/smoothness/ao texture "emissive" for the emissive/lightmap texture "normal" for the normal/bump map texture

I suggest not to delete any of those texture nodes, in case you'll need them at a later stage. If you don't want a certain texture map to show up on your model, just disconnect the corresponding link.

By default, the emissive image texture is not connected to anything. If you want to see the effects of your lightmap on the model in Blender, simply link the texture node with the input socket labeled "Emission"/"Emissive Color". Note that the emissive map doesn't have to be linked with the base shader node in order for the lightmap texture being found by the exporter!

PBR Material mode

alt The shader graph for PBR material.

When you switch to the PBR Material mode, the shader graph will be populated with a "BSDF Principled" node and a number of nodes that are linked up with the principled's input sockets. You can revise the material at any point by removing nodes or links. You can also add logic blocks between existing links and observe the effects in the viewport. Keep in mind however, that those type of changes will have no effect on the model when you export it to Prepar3D.

Albedo/Diffuse Map

The Albedo/Diffuse map uses the "Base Color" input socket of the BSDF Principled node. By default, the Alpha channel of the texture node is linked with the Alpha input socket of the BSDF node. For all opaque materials this should have no effect, but for transparent materials it is important that the link remains.

It is possible to modify the shader graph to display the Ambient Occlusion channel of the metallic texture. To do that, add a "MixRGB" node to the shader graph and switch the blend mode to "multiply". Next, connect the Color channel from the albedo texture node to input Color1 of the mixRGB node, and connect the green channel ("G") from the "separate RGB" node of the metallic node to the Color2 input of the mixRGB node. Lastly, connect the output of the mixRGB node to the Base Color input of the BSDF Principled Shader node.

Make sure to disable Ambient occlusion in the scene render settings to not over-saturate the shading.

Metallic Map

The metallic texture consists of three channels. The red channel represents the "metallicness" of the material, the alpha channel the "smoothness" and the green channel can contain an ambient occlusion map. Since Blender is using "roughness" rather than "smoothness", it is necessary to invert the alpha channel of the metallic texture before plugging it into the BSDF Principled node. This is already done for you when you set up the material for PBR.

By default, the AO map is omitted, see above if you want to display it in your scene.

Specular Material mode

alt The shader graph for specular material.

If you select "Specular Material" as the P3D/FSX material mode, the current shader graph is removed and replaced. The main shader node will now be an "Eevee Specular" node. The shader graph will be populated in a way that most closely represents the shader mechanics of FSX/P3D and all you need to do is adding your texture files to the various texture image nodes. As with the PBR shader graph, you can modify the Specular shader graph in any way you wish - as long as the original Texture image nodes and the Eevee Specular node remain, the exporter will be able to pick up the correct texture paths.

Please note that since it is a node specifically designed for the Eevee render engine, material created in this way won't render properly if you switch the viewport render mode to "Cycles".

Normal maps for PBR and Specular material

Prepar3D and FSX use a non-standard approach to rendering normal maps. This non-standard rendering path is taken into consideration in the Blender2P3D/FSX shader graphs. That means that you can use a normal map that is specifically prepared for P3D/FSX and plug it into the shader - it will render very closely to what you'll see in the flight simulator. The only change that is not taken into consideration is the vertical flip of the texture, so work with the un-flipped version of the texture in Blender.

Environment/Reflection map

Oppose to P3D, Blender is using a global reflection map in conjunction with reflective materials. Depending on your requirements, it might be necessary for you to utilize different reflection maps for different materials. To accommodate this, you can link any reflection map to any material, using the Parameter "Reflection map" under the P3D/FSX material properties. However, any change to the file or file-path will not change anything about how reflections are presented in Blender. If you would like to get an idea of how your reflection map works with your other material settings, you can manually change Blender's global reflection map. To do so, open the "World Properties" and under "Surface->Color", select "Environment Texture" as a new source for the world reflection map and navigate to your texture. Don't forget to change the render mode to "Viewport Shading". Please note that changes to the world properties won't be taken into account when exporting your model to .X or .MDL.

Transparency

If you're working with PBR material, switching your material to transparent is simple. In the P3D/FSX material settings change the "Render mode" to "Masked". The transparency value is taken from the Alpha channel of the Albedo texture node and will be visualized in the viewport. Note that switching from "Opaque" to "Masked" will also enable Backface culling by default, this is simply done for your convenience, but you can switch it off at any time with no effect to the P3D/FSX model itself.

Transparency for Specular material is currently not automated in this way, so any changes to the "Framebuffer Blend" properties of the material will have no effect on how the model is displayed in Blender. These values are, however, taken into consideration when you export your model and should work as expected.

Exporting to .X/.MDL

tbc...

Credits and license

The addon in its current version is the hard work of many members of the fsdeveloper.com forum. The original FSX2Blender addon was developed by: Felix Owono-Ateba, Ron Haertel, Kris Pyatt (2017) and Manochvarma Raman (2018) This current incarnation of the addon uses most of the original algorithms, but with an updated UI and compatibility for Blender 2.8x. Parts of the original exporter script have been re-written to accommodate Blender's new material workflow and to add PBR support to the addon (P3D v4.4+ only). This work was done 2019/2020 by Otmar Nitsche.

Special thanks go to Arno Gerretsen and Bill Womack for their input during the development and testing of the addon.

The software is licensed under GNU General Public License (GNU-GPL-3). Feel free to use it as you see fit, both for freeware and commercial projects. If you have suggestions for changes, use the support thread in the forum. If you would like to get involved in the development of the addon, contact any of the authors mentioned above to coordinate the effort.