Board index FlightGear Development Scenery

Converting xplane scenery

Questions and discussion about enhancing and populating the FlightGear world.

Re: Converting xplane scenery

Postby dom_vc10 » Mon Nov 08, 2021 5:45 pm

I'm getting further.

Batch convert models - Done
Get object co-ordinates from xplane DSF file to convert to STG - Done

To Do..

Learn how to use FGelev script to create the altitude data for each object
Create xml to apply night textures to objects
Remove OSM buildings which conflict with converted objects

Help needed....
With regard to my last to do point. I understand the OSM buildings have an STG file in the buildings folder. Can I just remove the lines for the conflicting buildings and have that in my custom scenery folder (of course using the same directory structure) or there is another way to block specific ones?
dom_vc10
 
Posts: 339
Joined: Mon Jul 27, 2020 8:33 am
Location: CZ - LKTB
Version: nightly
OS: Linux Mint 20.2

Re: Converting xplane scenery

Postby merspieler » Tue Nov 09, 2021 9:23 am

dom_vc10 wrote in Mon Nov 08, 2021 5:45 pm:Can I just remove the lines for the conflicting buildings and have that in my custom scenery folder (of course using the same directory structure) or there is another way to block specific ones?


That won't work. You've got to copy osm2city, remove the buildings there and disable the ones from terrasync. Else you'll load stuff twice.

The right way to do this is submitting the models to the model database. The affected tiles will automatically get marked for rebuild and the rebuild will solve the conflict.
Nia (you&, she/her)

Please use gender neutral terms when referring to a group of people!

Be the change you wish to see in the world, be an ally to all!

Join the official matrix space
merspieler
 
Posts: 2244
Joined: Thu Oct 26, 2017 11:43 am
Location: Wish to be in YBCS
Pronouns: you&, she/her
Callsign: you&, she/her
IRC name: merspieler
Version: next
OS: NixOS

Re: Converting xplane scenery

Postby dom_vc10 » Tue Nov 09, 2021 10:06 am

Ok clear. I was hoping that was not going to be the answer :D

Lots of XP scenery uses shared libraries and some of the other sceneries have a mix of authors. If we get half to agree and half don't it doesn't help much. If the scenery is by just one developer then there are maybe possibilities to ask them to release under the license we need. I do not think that most will accept this, some will, I know you have at least one example. It would be good to still have the option to use those that do not agree. Anyway that's how the system is built so not much to do for now.

Thanks for the confirmation.

(just one note what exact license should the scenery be using. I will contact one of the developers of a scenery I am converting to to see what the response is)
dom_vc10
 
Posts: 339
Joined: Mon Jul 27, 2020 8:33 am
Location: CZ - LKTB
Version: nightly
OS: Linux Mint 20.2

Re: Converting xplane scenery

Postby wkitty42 » Tue Nov 09, 2021 1:55 pm

AFAIK GPL2(+) is the desired license for pretty much everything used in and distributed by FG...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9149
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: Converting xplane scenery

Postby dom_vc10 » Tue Nov 09, 2021 7:57 pm

thanks
dom_vc10
 
Posts: 339
Joined: Mon Jul 27, 2020 8:33 am
Location: CZ - LKTB
Version: nightly
OS: Linux Mint 20.2

Re: Converting xplane scenery

Postby dom_vc10 » Fri Nov 12, 2021 11:25 am

Just to share something.

If anyone want to batch convert the models using blender 2.8

For blender install these two adons
https://github.com/tnemec/Xplane2Blender_Importer - This is used to import the xplane objects
https://github.com/NikolaiVChr/Blender-AC3D/tree/2.80 - This exports the ac format for FG

Code: Select all
import bpy
import os

for root, dirs, files in os.walk('path to your xp models directory'):
    for name in files:
        if name.endswith('obj'):
            # delete everything
            bpy.ops.object.mode_set(mode='OBJECT')
            bpy.ops.object.select_all(action='SELECT')
            bpy.ops.object.delete()
            # adjust this to match the import smd operator
            bpy.ops.object.xplane11import(filepath=os.path.join(root, name))
            bpy.ops.object.mode_set(mode='EDIT')
            bpy.ops.mesh.select_all(action='SELECT')
            bpy.ops.mesh.flip_normals()
            bpy.ops.object.mode_set(mode='OBJECT')
            # export as ac
            bpy.ops.export_scene.export_ac3d(filepath=os.path.join(root, name+'.ac'))


Then run the above script in blender. This will then convert all the xplane obj files to ac files. I found that for some reason the normals are a bit messed up so added a bit in the script to flip the normals and that seems to resolve that issue.

I also found that sometimes the models point to a png however the xplane object has a dds texture file. Right now it seems the best to use png, I had some weird issues with using dds. If you do convert all textures to png you can run the following to update all the ac files.

Place all your ac files in a directory open the terminal and run the code below. It will replace .dds to .png in all the files.
Code: Select all
sed -i -- 's/.dds/.png/g' *
dom_vc10
 
Posts: 339
Joined: Mon Jul 27, 2020 8:33 am
Location: CZ - LKTB
Version: nightly
OS: Linux Mint 20.2

Re: Converting xplane scenery

Postby merspieler » Fri Nov 12, 2021 11:28 am

Let me guess, messed up textures with .dds? It's cause in .dds the Y axis if flipped...
Nia (you&, she/her)

Please use gender neutral terms when referring to a group of people!

Be the change you wish to see in the world, be an ally to all!

Join the official matrix space
merspieler
 
Posts: 2244
Joined: Thu Oct 26, 2017 11:43 am
Location: Wish to be in YBCS
Pronouns: you&, she/her
Callsign: you&, she/her
IRC name: merspieler
Version: next
OS: NixOS

Re: Converting xplane scenery

Postby dom_vc10 » Fri Nov 12, 2021 11:34 am

yep that explains the issue I was seeing.
One other thing I found is sometimes models point to a DDS but the package had a png anyway so for now to be consistent I am putting everything as a png. but the main issue was that.
dom_vc10
 
Posts: 339
Joined: Mon Jul 27, 2020 8:33 am
Location: CZ - LKTB
Version: nightly
OS: Linux Mint 20.2

Re: Converting xplane scenery

Postby dom_vc10 » Fri Nov 12, 2021 4:46 pm

[quote="merspieler";p=394505
That won't work. You've got to copy osm2city, remove the buildings there and disable the ones from terrasync. Else you'll load stuff twice.
[/quote]

In the past I used to use terramaster but right now use terrasync as terramaster can't use the files right now due to the compression format. How do I disable the ones from terrasync? Is there a way I can block them as I assume if remove them or modify them terrasync will replace them when it syncs the files again.
dom_vc10
 
Posts: 339
Joined: Mon Jul 27, 2020 8:33 am
Location: CZ - LKTB
Version: nightly
OS: Linux Mint 20.2

Re: Converting xplane scenery

Postby merspieler » Fri Nov 12, 2021 8:52 pm

You can't keep terrasync enabled and modify it files... you can have one or the other.
Nia (you&, she/her)

Please use gender neutral terms when referring to a group of people!

Be the change you wish to see in the world, be an ally to all!

Join the official matrix space
merspieler
 
Posts: 2244
Joined: Thu Oct 26, 2017 11:43 am
Location: Wish to be in YBCS
Pronouns: you&, she/her
Callsign: you&, she/her
IRC name: merspieler
Version: next
OS: NixOS

Re: Converting xplane scenery

Postby dom_vc10 » Fri Nov 12, 2021 9:06 pm

Yes, that was clear, I am not sure if I was so clear. I will maybe ask you on matrix. A conversation will be easier
dom_vc10
 
Posts: 339
Joined: Mon Jul 27, 2020 8:33 am
Location: CZ - LKTB
Version: nightly
OS: Linux Mint 20.2

Re: Converting xplane scenery

Postby dom_vc10 » Fri Nov 19, 2021 12:07 am

Well. I seem to have finally figured out my own way to get xplane scenery into FG. When I say airport I mean all models I am not trying to change runways, taxiways etc..
One item left is to get night lighting by textures and by setting the ambient settings for parts of the models, luckily the wiki is pretty good for that so it will be the next step. SO far I converted 3 airports. First two took me several weeks whilst I set up my workflow and got to understand how to do it all. It's not easy and needs a lot of attention. Scripts can only get you so far you need to still have some manual input. The final airport took just a few ours so that's progress from weeks :-)

Brno
Image
Gloucester
Image
Liverpool
Image

Need to see if any of the developers would allow this to be shared.
dom_vc10
 
Posts: 339
Joined: Mon Jul 27, 2020 8:33 am
Location: CZ - LKTB
Version: nightly
OS: Linux Mint 20.2

Re: Converting xplane scenery

Postby merspieler » Fri Nov 19, 2021 9:51 am

awesome... have you documented it somewhere?
Nia (you&, she/her)

Please use gender neutral terms when referring to a group of people!

Be the change you wish to see in the world, be an ally to all!

Join the official matrix space
merspieler
 
Posts: 2244
Joined: Thu Oct 26, 2017 11:43 am
Location: Wish to be in YBCS
Pronouns: you&, she/her
Callsign: you&, she/her
IRC name: merspieler
Version: next
OS: NixOS

Re: Converting xplane scenery

Postby dom_vc10 » Fri Nov 19, 2021 10:24 am

Not yet. I plan to do that though and maybe put on the wiki as an alternative to what is there already. It's quite a messy way of working though. I had to change my set up a bit and move away from automatic downloads due to the stg changes to remove the OSM buildings.
dom_vc10
 
Posts: 339
Joined: Mon Jul 27, 2020 8:33 am
Location: CZ - LKTB
Version: nightly
OS: Linux Mint 20.2

Re: Converting xplane scenery

Postby merspieler » Fri Nov 19, 2021 10:32 am

Well... if you've got something working, I might be able to build an automation on that
Nia (you&, she/her)

Please use gender neutral terms when referring to a group of people!

Be the change you wish to see in the world, be an ally to all!

Join the official matrix space
merspieler
 
Posts: 2244
Joined: Thu Oct 26, 2017 11:43 am
Location: Wish to be in YBCS
Pronouns: you&, she/her
Callsign: you&, she/her
IRC name: merspieler
Version: next
OS: NixOS

PreviousNext

Return to Scenery

Who is online

Users browsing this forum: No registered users and 1 guest