Creating New Aircraft - II

Take a look at the image on the right: What is it? It is an export of the standard cube that Blender ( 2.49 ) in this case exported into YSFlight using the scripts for Blender. It has taken off and is flying, replacing the sleek shape of the Mirage 2000.

The point of this exercise is to show that it is easy to get an aircraft exported into YSFlight and have it fly right away.

Updated May 22, 2022

In this section, I will explain how to create an aircraft model in Wings 3D, and how to export the basic model into YSFlight using Blender 2.49. This section will cover:

How to export the model from Wings 3D to Blender in .lightwave (.lwo) format

How to Import into Blender and export in .dnm format

How to install model to YSFlight

How to create a transparent canopy

How to add retracting landing gear animations

Creating the Model in Wings 3D

First, create the model in Wings 3D, an easy to use 3D modeller. I used version which is stable in for my use and also contains the export and import menu items needed: export to .lwo (lightwave)which is the most trouble free format that I have used so far, exporting to Blender 2.49 without any errors and Blender, in turn exports to the YSFlight native .dnm format without any errors, and it works fine in the simulator with all materials and shadings intact.

I will not explain how to use Wings 3D, but the model pictured was created in about an hour using the cube shape, the sphere shape and using extruding, bevelling and scaling functions as well as some inset and extrusion for the air intakes and exhausts. The model was roughly done to resemble the famed Aurora aircraft but does not follow any three views or pictures, and was created solely from memory.

The aircraft is created in Wings 3D. No dimensions are set for the moment, but the model needs to be centred and positioned correctly. Blue and black material shading is applied and previewed in the shading mode. The model is exported into the .lwo format. (Lightwave)

Importing the model into Blender

Imported into Blender. The .lwo object appears correctly with the proper shading and colors, and no errors were generated.

Using the Object mode in Blender, the model can be placed by selecting all and clicking and dragging the red, blue or green arrows.

Exporting to .dnm YSFlight model format from Blender

As stated earlier, the model is exported as lightwave (.lwo) object from Wings 3D, and imported into Blender 2.49, which contains the scripts for exporting to the .dnm format. (Dynamodel (.dnm) as listed here in the Blender 2.49 export menu. Here I export the model to .dnm

The aircraft is in YSFlight ...

A first view of the aircraft in YSFlight. There are several things wrong with this picture - the plane is pointed in the wrong direction, it needs to be rotated 90 degrees to the right side, in Wings 3D that would be to align with the X - axis, pointing toward the user.

The model is too small - the AAM missiles should fit under one third of the wing, roughly.

On the plus side, the shading and colors are all correct.

Scale the model

We need to decide on a scale for the model. The Mirage 2000 is roughly 15 metres in length, so we make this the same size. Scale the model in Wings 3D to span15 squares. Height above the ground has to be determined from the simulator, and animations are not implemented at all. The model will fly, in the manner specified by the .dat file, and will even do air combat with the missiles shown.

Creating the files

The next step is to create the collision, coarse and cockpit files and rework the .dat file to configure the flight model.

More on the .dat file here.

Copy one of the existing set of files for an aircraft into a folder called 'user' which you will have to create. On my PC it is at the ysflight.com/user/aircraft/stealthplane folder. Copy the Mirage2000 files into this folder. Rename the mrge2000.*** files as stealthplane.** files preserving the naming structure as shown.

In order to load this aircraft into the YSFlight simulator, the following line has to be added to the aircraft.lst file (That's LST) in the aircraft folder. (Highlight and use the replace function)

user/aircraft/stealthplane/stealthplane.dat user/aircraft/stealthplane/stealthplane.dnm user/aircraft/stealthplane/stealthplanecoll.srf user/aircraft/stealthplane/stealthplanecockpit.srf user/aircraft/stealthplane/stealthplane_coarse.dnm

Change the line in the .dat file to identify the aircraft as follows:

IDENTIFY "Stealthplane".

Load YSFlight and select the STEALTHPLANE. The same old Mirage 2000 model is displayed, so everything works, we need to change the model to the stealth plane model. If you have not already done so, scale up the model in Wings 3D, rotate it to the right 90 degrees so the model is along the x-axis and pointing outwards from the screen, and export it to .lwo, import to Blender, export to stealthplane.dnm in the above folder.

The name of the plane shows up in the YSFlight menu. If the aircraft entries appear at the top of the .lst file the name will appear at the top of the list.

The Stealthfighter hovering above the runway, with a nice shadow as well, auto generated. No landing gear has been modeled, otherwise everything seems OK.

A top view, again on the runway

After take - off, in a turn to the left. Note the shadow which is automatically modelled from the .dnm 3d file.

Transparencies

Transparencies are one of the hidden mysteries of YSFlight, consisting of unfathomable ZA values, so lets see how we can decode these and apply them to the stealth fighter model. The information I was able to obtain using transparencies was not very easy to understand, so I decided to experiment and come up with a simpler explanation.

The first thing was to download an existing aircraft that did have a transparency, a transparent canopy. Downloading an F-16 Thunderbirds model from "rainman" the following lines are found at the end:

ZA 0 200 1 200 2 200 3 200 4 200 5 200 6 200 7 200 8 200 9 200

We know that the ZA values somehow modify the surfaces to make them transparent, but how exactly is this done?

Look at the following information on srf files, https://ysflightsim.fandom.com/wiki/SRF_Files and then let's look at the Blender 2.49 export scrip generated file for the default cube:

On the left is the DNM file for the default cube from Blender created by the export to .dnm function. Using the information from the above fandom wiki, we see these things:

SURF is the surface data section which defines the surface. The vertex positions of the object, the cube, on the X, Y, Z axes are given. There are of course 8 vertices to a cube.

Look at the line staring with F. The first face is defined in that section. This is face number 0. Each face has an ID number depending on its position in the .srf section, starting from 0 upto the maximum number of faces.


FC 204 204 204 The color of the faceN 0 -1 0 0 -1 0 The Normal V 0 1 2 3 Vertex ID numbers for the faceE

The question is, where do we write the ZA values to make on face transparent?

The ZA setting follows the following syntax. As an example:


ZA 0 50

"ZA FACEID VALUE FACEID VALUE...

The transparency or Alpha of a face"

(from the above guide)

So let's see, the above value makes face 0 transparent. I first colored the faces by changing the color values to differentiate them. Then I added the ZA value to the text file.


ZA 0 200

Loading the cube as a replacement model for the a4f.dnm we have the following view:

This instantly turns one of the faces transparent, face 0.

DYNAMODELDNMVER 1PCK Cube 44SURFV -1 -1 1V 1 -1 1V 1 -1 -1V -1 -1 -1V -1 1 1V 1 1 1V 1 1 -1V -1 1 -1FC 204 204 204N 0 -1 0 0 -1 0V 0 1 2 3EFC 204 204 204N 0 1 0 0 1 0V 4 7 6 5EFC 204 204 204N 0 0 1 0 0 1V 0 4 5 1EFC 204 204 204N 1 0 0 1 0 0V 1 5 6 2EFC 204 204 204N 0 0 -1 0 0 -1V 2 6 7 3EFC 204 204 204N -1 0 0 -1 0 0V 4 0 3 7EE
ZA 0 200
SRF "Cube"FIL CubeCLA 0NST 0POS -0.0000 0.0000 0.0000 0 0 0 0CNT 0.00 0.00 0.00REL DEPNCH 0ENDEND

The cube without transparencies in YSFlight preview

The cube with the ZA as follows:

ZA 0 50 with reduced opactity

The cube with a higher ZA value,

ZA 0 200. Increased transparency.

Let's summarize what has been done here. A simple cube has been exported into YSFlight using Blender. The cube .dnm file has been accessed, and the faces of the cube have been identified where they are defined in the .dnm file, these faces start with F.

Immediately below the face definition, we added the ZA modifier to make the faces transparent. This is done by writing ZA, the number of the face, Face 0 in this case, and the transparency value from 0 to 255, 255 being the most transparent as can be seen from the examples, 200 is more transparent than 50.

The 'cube' in YSflight: the green grass and lake can be seen through the cube.

Can this transparency method be implemented on a the Stealthplane model? Yes it can, however the canopy of the original model needs to be changed - as a spherical object, there are too many faces to deal with. A faceted canopy of less than 10 faces was created.

To identify the faces, each face was colored bright blue, that is, C 0 0 255. Now all the faces on the canopy could be identified as seen on the right by the C values. We can even count the number of faces, there are in all 6 faces, 0 to 5.

Adding the ZA modifier should change the faces to transparent, and it does just that.


ZA 0 200 1 200 2 200 3 200 4 200 5 200

The next step of course is to load the model into YSFlight. The transparent canopy shows up. There is no cockpit 3D model and so the transparency only shows the blue fuselage section underneath. Turning the plane to a side, however show up the transparency.

Additional faces:

ZA 0 128 1 128 2 128 3 128 4 128 5 128 6 128 7 128 8 128

ZA 9 128 10 128 11 128 12 128 13 128

FC 0 0 255N -0.3957 0.2431 1.2676 -0.9391 0.3436 0V 3 0 1 2EFC 0 0 255N 0 0.5085 1.2676 0 1 0V 1 5 6 2EFC 0 0 255N 0.3957 0.2431 1.2676 0.9391 0.3436 0V 4 7 6 5EFC 0 0 255N -0.2953 0.1737 2.1733 -0.8766 0.392 0.2791V 2 8 9 3EFC 0 0 255N 0.2953 0.1737 2.1733 0.8766 0.392 0.2791V 7 10 11 6EFC 0 0 255N 0 0.3358 2.1733 0 0.9225 0.386V 6 11 8 2EE
ZA 0 200 1 200 2 200 3 200 4 200 5 200


The transparent canopy in place...