6. Using PBR materials in X-Plane
Alongside textures, you also need to assign certain properties to the objects, otherwise, they will not look right. I’ve actually learned a few things myself while trying to make sure this tutorial explains things correctly!
Note: For the purpose of this tutorial, I will simply show you what you need to do, not why you need to do it.
I’m not gonna go into details and theory of PBR (Physically Based Rendering) materials because it’s a very complex topic and others have covered it well. So I advise you to read the following articles if you want to understand what you’ll be doing.
6.1 How to enable Normal maps in X-Plane
This is actually pretty straightforward. Once you have the normal texture created, we just need to make sure that the plugins exports the TEXTURE_NORMAL line in the header.
Some people online mention opening the exported file in a text editor and adding this line of text manually.
This is possible, but please do not ever edit the OBJs manually.
This is a wrong workflow, because your changes will get overwritten every time you export. If you have everything set up correctly, you should not ever need to do it.
AC3D
1. Go to X-Plane > X-Plane Export Settings
2. Tick Export TEXTURE_NORMAL lines
If you cant see that setting, you may need to get the latest AC3D X-Plane plugin.
3. The plugin will assign the same name as the main texture + a suffix “_normal.png”. This means that you need to have your normal map textures end in that, or else it won’t find the texture.
4. The Cessna’s fuselage normal texture is called fuselage_NRM.png. So in order for our object to be able to find it, we need to make a copy of that texture file, and rename it to fuselage_normal.png
Blender
The exporter will automatically write out this line if we define the Normal texture name in the Root Collection > Textures dialog.
We have already defined the fuselage.dds as the color texture in step 3, so now we just need to repeat that with the normal texture.
Open file explorer and go to ..\X-Plane 11\Aircraft\Laminar Research\Cessna 172SP\objects and locate the normal texture we want to use fuselage_NRM.png
Go to the Scene Properties > X-Plane > Root Collections > Textures
In the Normal/Specular field, write fuselage_NRM.png
Let’s check if that worked straight away
Export the cube again
In X-Plane reload the airplane by going to Developer > Reload the current Aircraft and Art (I have this assigned to F11 on my keyboard)
If you zoom in onto the cubes in X-Plane, they should now show the details of the normal map, like the rivets. If you can’t see them very well, try changing the time of the day to sunset, as the details should react to light change.
And after examining the exported files in a text editor, we should now see the TEXTURE NORMAL line written out in the header as well.
AC3D
blender
6.2 How to make objects shiny/reflective and metallic in X-Plane
In other words, how to make sure the specular and metallic channels are being applied correctly.
First of all, this is after you’ve already created a normal texture that contains the specular map in the alpha channel and the metallic map in it’s blue channel. Read more about that in the links above.
Substance Painter does this automatically when using the X-Plane Export config.
In a nutshell, we want to add two magical lines to the header of the OBJs:
NORMAL_METALNESS
GLOBAL_specular 1
NORMAL_METALNESS
Adding NORMAL_METALLNESS to the header will enable the rendering of metallic surfaces in X-Plane.
The AC3D plugin always seems to export that line by default.
GLOBAL_specular 1
Adding GLOBAL_specular 1.0 to the header of the OBJ file will make all exported objects 100% shiny (or in other words 0% rough). This can further be adjusted with normal maps that include specular maps in the blue channel.
This is really nicely explained in the first link I shared above.
AC3D
NORMAL_METALNESS seems to be added automatically using the latest AC3D plugin (3.5b1). Please correct me if I’m wrong, but I always get that line when I export from AC3D.
There are two ways to add GLOBAL_specular 1 in AC3D:
Option 1) The simple way
(This will require you to have the latest version (3.5b1) of the X-Plane plugin for AC3D)
Steps:
Go to X-Plane > X-Plane Export Settings
In the OBJ file header, write “GLOBAL_specular 1.0”
That’s all!
Option 2) The complicated way
You can use this in case you cannot use the latest plugin and you cannot automatically add the GLOBAL_specular 1.0 line to the header.
You will have to use AC3D materials, and use them to add specularity on a per-object basis, so you will not see the line in the header, but you will see the same result.
1. To check which material is assigned to your objects, go to the Select Surfaces mode (S on the keyboard) and click on one polygon on the object you want to check.
2. When we click on one side of our cube, the info on the bottom bar in AC3D tells us which material is assigned to it:
BLENDER
Both the lines above are added in one single step:
With the cube selected, go to the Material properties
Scroll down to X-Plane
Tick Normal Metalness
What this does is it will write out two additional lines in the header:
These will
That’s it!
In my tests, changing the specular and roughness values on the Blender shader did not have any effect on the final exported OBJ, so you can leave those values all at default.
Although the xplane2blender documentation says that specular is one of the values exported and read by X-Plane, but the screenshots seams to be a bit dated so it is a bit confusing.
3. We can see that the index is 1. You can find all the materials in the Palette tab on the bottom of the left side menus:
The materials in AC3D don’t really give us many options. The only things that will affect the final look in X-Plane are the Diffuse, Specular and Emission.
4. We can edit the first material, however from experience I found that the default materials often reverse the values to default, so it is better to Append a new material:
Right-click on any of the materials in the Palette and click on Append new material.
Go to the end of the line of materials, and you should now see the 15th material.
Right-click on it again, and click Edit Material
DIFFUSE
Always leave it white. If you made it red, all your textures would turn out to be red too.
EMISSION
Using Emission on the whole object would not be practical so just forget it and always leave it black. Later on, we will use textures to enable LIT effects on the cube.
SPECULAR
In order to see the surfaces shiny in X-Plane, we need to make sure the specular value of the material is 1.0 (full white).
Click on the + next to the Specular and drag all three sliders to the right. This will give the specular channel a global value of 1.0.
Note: The “Shininess” only affects the look inside AC3D, it does not affect the final XP look in any way.
I bet that at this point you’d wonder why the hell would anyone use this method when the first one was done in two steps! Well I used to do all of this until today, when I relized that using the AC3D materials is not necessary if the “GLOBAL_specular 1.0” variable is defined. So I learned something today too!
5. Anyway, let’s now make sure this material is actually assigned to our cube and that X-Plane will recognize it:
Select the cube in the Object Select mode
Then simply click on the 15th material in the Palette and it will be assigned to our cube.
On the top bar, go to X-Plane > X-Plane Object Properties
Under Surface: tick Use AC3D Materials.
Note: If you are using this method, you will have to set this setting for all of your objects! You can select all of your objects, then tick Apply to All on the bottom of the X-Plane Object Properties window and then tick “Use AC3D Materials”. It is good practice to uncheck the Apply to All after doing this so that you don’t forget that it stayed on later.
Let’s check if that worked
Reexport your cube
Reload aircraft in X-Plane
The cubes should now also be shiny
7. Single sided polygons
On the picture above where we selected one face of the cube, we can also see that the last thing the info line says is “2S”. That means that our polygons are all double-sided.
Generally, to improve performance, we want to make sure that we always use one-sided polygons on our objects. Only use double-sided polygons if you really need two-sided polygons (e.g. trees, where both sides are visible all the time.)
AC3D
To make your objects single-sided, simply select the whole object, (or all objects) in the Object Select mode, and then click on 1S on the Set Surface Type tab:
blender
Blender seems to export surfaces as single sided by default, so I didn’t do anything here.
Animating the Cube
The cube will rotate based on a dataref. Datarefs are links or references to values that X-Plane writes out every frame. These mostly numerical values drive the animations of our objects.
How to import in planemaker
LIT TEXTURES:
In order to export the _LIT line, I need to either make something a dynamic LIT or export a material that has emission more than zero.
2. Creating a cylinder
AC3D
1. In the same way, we will create a cylinder. In the Mode section, click on the cylinder.
2. Then in the Cylinder section select 24 segments. If you cannot see the Cylinder section, or any other section, just click on the lines between sections and drag them down.
3. Again, place it in the viewport.
4. In the Utils section, write [2.0 , 0, 0] in the first three windows and hit Move to. This is where you can define a position and move it there.
5. The next three windows define the size. Set it to [ 0.2, 0.8, 0.8] and hit Size to.
Blender
3. Importing a carrot
AC3D
File > import > Navigate to the folder you downloaded and unzipped, go to 3D models and select Carrot.obj.
The carrot was placed into the origin, but since we already have a cube in our origin, it is hidden inside. You can see the green handles through the cube though, indicating that it is still selected.
You can also hit W on your keyboard, which will toggle the wireframe view on and off.
On top of the window, click on 200%. That will double the size of the carrot. Click on that three more times so that the carrot becomes bigger than the cube.
We also want to rotate the carrot so that it is vertical. Under the Scale button in the Utils section, select the Z axis, and hit the minus sign. This will rotate the carrot.
After that, drag it directly up in the viewport to get it above the cube.
Blender
Then do the same for the cylinder, but instead of cockpit.dds, use wings.dds.
You will notice that the sides of the cylinder are black. That is because the cylinder object does not have UVs defined on the caps (one of the weird things AC3D does).
You will need to go to the Select Surface mode, and then select only the side polygons of the cylinder.
Then hit F10 to open the Texture Coordinate Editor (basically the UV editor) or Tools > Texture Coordinate Editor and click on Remap > Left
For the carrot, select the texture in the unzipped folder.