I read this article with great interest and I wanted to do some tests. Meanwhile, I noticed that OSG has its own binary format called ".ive", this format is recommended as it is faster in loading.
For my tests I used a rather complex object that reproduces the Bendix type J8 used for the FIAT G91-R1B, but also installed in many other aircraft of the 50s and 60s of the last century.
The gauge was made by Freecad, and then exported with the obj, the size of the freecad file is 1.4 MB which becomes 3.3 MB when exported to OBJ.
Unfortunately Freecad uses different units of measure, which exchange the meters (used by Blender) in mm (used by Freecad). So I had to rescale the file using Blender.
Another problem is that Freecad converts objects into meshes by adding the postfix "(Meshed)" so the name of an object becomes: "xy_x" -> "xy_z (Meshed)". Blender when it converts the file to OBJ instead changes the name: "xy_x" -> "xy_z_ (Meshed)", which replaces the space with a "_". At this point I have to edit the names contained in the file with an editor or edit the XML. The decision must be taken once and for all, is simple solution and works well.
This is the image that was obtained through the .ac file. The fact that it looks so dark is due to the application of the shadows through an "Interior Shading" effect.
Instead the result obtained using the .obj file resized by Blender (nothing else has been done) is this:
Actually it seems better, but I doubt that the "Interior Shading" effect is working!which instead is present in the other gauges that surround the image. Honestly I do not understand the reason for this problem because the file will then be converted to .ac, always in Blender, and the result that you see in the previous image. Freecad should not include its attributes, but it is probably a problem related to the fact that they are missing MATERIALS! f you look at objects in Blender, you can see that no one has a material definition. This could be the basis of the problem. But the materials are fully defined XML (which in fact prefer) even if it takes a little patience.
Reading the online manual of "openscenegraph" I found that there is an OBJ converter in a binary OSG format called ".ive":
http://www.openscenegraph.org/index.php/documentation/guides/user-guides/55-osgconvThis binary format, says the manual, is very efficient as it does not require any conversion and therefore its loading is immediate. Intrigued I tried to use this command, I loaded it on my Linux system Kubuntu 17.10 (I took version 3.4 of the command) and I did the test by entering the scale and the translate (necessary because the scale must be followed by a redefinition of the centers of reference).
This is the command (I used the obj file produced DIRECTLY by Freecad):
- Code: Select all
osgconv -t 0,0,0 -s 0.001,0.001,0.001 j8.obj j8.ive
This is the result:
The object has kept all its automation etc .. There is always the strange behavior with the effect, but at this point I do not know if it's correct this version or the other in .ac ... I will see to deepen.
This test has several important consequences:
1. You can build 3D objects in FreeCAD, and import them directly to Fgfs without using Blender.
2. You can use the OSG binary file, making this time probably faster loading of complex objects.
3. I do not know how stable the OSG binary format over time is for future versions, but nothing prevents you from automating this process in the FGFS loader. This way you could have a real improvement in loading performance for larger files.
4. Exporting files from FreeCAD to blender via OBJ does not involve materials, this feature can only be managed via XML. But this is a design choice, in the G91-R1B objects use only one type of material (type 0). Everything else is obtained through XML transformation, the performances (now that we are about 2/3 of the project) do not seem to have a particular reduction.