Object generation utility



  • A significant feature of VFR flight are lines of power pylons stretching off into the haze.

    In the absence of a MakeAF2Object directive in scenProc, I created a utility PYLONGEN to parse OSM files and generate a TSC file with entries

    for each node along ways tagged with k="power" v="line".


    PYLONGEN will use the bounds defined in the OSM file to calculate the coordinates

    for the TSC and reject any pylon points out of bounds.


    PYLONGEN expects the arguments

    - path to OSM file

    - [optional] relative path to PowerPylonModels folder in the deployed scenery folder structure. Assumes the same folder if arg not provided. This allows positioning the

    PowerPylonModels folder to be shared by multiple tsc files in a folder hierarchy. I place the generated tsc (along with other cultivation files) in places subfolder

    for each 0.1x0.1 cultivation tile. The PowerPylonModels folder at a higher level in the hierarchy can be shared by all tiles.


    The utility will produce TSC and log files in the current directory.


    Model selection precedence

    If the power="line" way has a tag model="yourSiteSpecificModelName", the specific model will be used for that line. This allows customization for distinctive pylon styles.


    If no model defined but the line has a cables tag defined for the way, a generic N-cables model name will be be selected based on number of cables. A number of generic pylon models have been provided. if you encounter cable arrangements not supported there will be "not found" errors in the tm.log for the missing tmb files. You have the choice of creating a model for that configuration or setting a specific model for the way .

    As a last resort the defaultPylon model will be used.


    Way and node ids are added to the TSC to track back to OSM file for any missing or spurious towers.


    Model development


    Example models were converted from SketchUp 3DWarehouse (I found ZoSoChiles 3d Model conversion post most helpful in getting the pylon models converted.)


    The model base must be centered on the drawing origin.

    No geo-position info should be defined in the model.

    The model should be aligned for a east west cable run.

    The piers should be extended well below grade to allow for slope placement. Steep slopes may require manual elevation tweaks in the TSC.


    Limitations

    You may need to set the time of day to align 3D generated shadows and ortho image shadows.

    Ortho image of power cables are sometimes highly visible and may not be aligned with implicit line of sight from the camera position. I do not think anything can be done to fix that.


    *****************************************************************************************

    *****************************************************************************************

    **** Note PylonGen has been superceded by generalized XML configuration driven osm2AFSobject

    *****************************************************************************************

    *****************************************************************************************


    The PYLONGEN utility has been uploaded to flight-sim


    /Stu

    i7-6700K CPU @ 4.00GHz | ASUS Z170-A | 16Gb DDR4 | Samsung SSD 950 PRO NVME M.2 256GB | Samsung SSD 850 EVO 1TB | GeForce GTX 1080 Ti on GP102-A GPU | Oculus CV1 | Windows 10

    Edited 4 times, last by lenidcamper: generalization ().

  • drhotwing1

    Changed the title of the thread from “Power to the People” to “Powerline model Utility”.
  • Stu, great work - looking forward to giving it a try!


    I was exploring the powerlines situation over the holidays but tabled it due to concerns about having +100 3D objects in a single TSC file for a big city. What are your typical pylon counts in your generated TSC files?

  • lenidcamper thank you for your work, for our community.


    For sure, and by far, AFS2 is the best flight simulator. But we need talented gents like you - and of course others - to enhance in the future our global immersive experiences. And Power lines are part of them. Would be so glad that in a near future, a quality scenery like Switzerland DLC can be enhanced by such remarkable obstacles, at least main power lines. Thank you very much formyour work: with people like you, as well as other AFS2 pionners in planes design, sceneries development and utilities creation, for sure, the flight simulation’s future looks bright :thumbup:

  • What are your typical pylon counts in your generated TSC files?

    The models average 7,000 or 8,000 vertices. (according to ModelConverterX)

    I did not spend any time on model optimization. I was more interested in proof of concept.

    It will be possible to substitute more efficient models if required.

    i7-6700K CPU @ 4.00GHz | ASUS Z170-A | 16Gb DDR4 | Samsung SSD 950 PRO NVME M.2 256GB | Samsung SSD 850 EVO 1TB | GeForce GTX 1080 Ti on GP102-A GPU | Oculus CV1 | Windows 10

    Edited once, last by lenidcamper ().

  • Sorry, I can’t figure out how to run the program with his "expected arguments"

    Is it possible to have an exemple or something that could help me to understand ?

    Thanks

  • sorry if it was not clear


    The following command entered from the command line in whatever folder you unzipped the PYLONGEN


    PylonGen.exe .\myOSMfile.osm


    would process the OSM file and generate the TSC and log file in the same folder. The TSC file would expect the PowerPylonModels folder at the same folder level in the scenery/places hierarchy that you deploy the TSC file.


    PylonGen.exe .\myOSMfile.osm ..\

    would allow the PowerPylonModels folder to be moved up to the parent folder of the TSC file in the deployed folder hierarchy

    The PowerPylonModels folder is only used at AFS2 run time not during the PylonGen step.


    Hope that clarifies things. Any other issues let me know


    /Stu

    i7-6700K CPU @ 4.00GHz | ASUS Z170-A | 16Gb DDR4 | Samsung SSD 950 PRO NVME M.2 256GB | Samsung SSD 850 EVO 1TB | GeForce GTX 1080 Ti on GP102-A GPU | Oculus CV1 | Windows 10

  • So great


    I only had a problem in the TSC file, it has generate this :


    ...

    <[file][][]

    <[tmsimulator_scenery_place][][]

    <[string8][type][object]>

    <[string8][sname][]>

    <[string8][lname][]>

    <[string8][icao][]>

    <[string8][country][]>

    <[string8][coordinate_system][lonlat]>

    <[vector2_float64][position][3,235 45,515001]>

    <[float64][height][0]>

    <[float64][size][5000]>

    <[vector2_float64][tower_position][0 0]>

    <[float64][tower_height][0]>

    <[bool][autoheight][true]>

    <[string8][autoheight_method][]>

    <[list_tmsimulator_scenery_object][objects][]

    ...

    I've just changed it by

    ...

    <[vector2_float64][position][3.235 45.515001]>

    ...

    And it was ok.



    I love the rendering :love:

  • I suspect something to do with culture dependent number formatting for the mid point.


    The pylon positions were formatted correctly?


    /Stu

    i7-6700K CPU @ 4.00GHz | ASUS Z170-A | 16Gb DDR4 | Samsung SSD 950 PRO NVME M.2 256GB | Samsung SSD 850 EVO 1TB | GeForce GTX 1080 Ti on GP102-A GPU | Oculus CV1 | Windows 10

  • Thank you Stu for your great tool.

    Would it be possible to also add objects like transmitter and cooling towers based on their OSM position?


    Cheers,

    Thomas

    Great tool! I wonder too if this tool can easily be adapted for other objects e.g. farmhouses. I mean just generate the TSC with coordinates, reference to object name can be entered manually by user.

    Best regards,

    Thomas


    i7-6700K @ 4.0 GHz, Geforce GTX 1080, 32MB RAM, 500 GB SSD, 1 TB SSD, 1TB HD, 32" Monitor 4K, Oculus Rift

  • Posted an update


    I think this fixes the locale dependent formatting issue.

    Some other cleanup as well.

    i7-6700K CPU @ 4.00GHz | ASUS Z170-A | 16Gb DDR4 | Samsung SSD 950 PRO NVME M.2 256GB | Samsung SSD 850 EVO 1TB | GeForce GTX 1080 Ti on GP102-A GPU | Oculus CV1 | Windows 10

  • Hi lenidcamper : thank you very much : your Pylon system looks great !


    In the future, it will be perhaps necessary to optimize the Pylon models, to avoid CPU or GPU saturation.... With thousand of pylon in a wide zone, I experienced some visual artifacts or bugs in the sky (reminds me sinister RAM usage problem of fsx years ago...). But I'm sure the models can be optimized.


    Anyway thank you very much to offer us this tool !


    Regards from Switzerland

  • I also noticed some AFS2 pauses with a moderate number of pylons.


    As I said the models were straight forward conversions from SketchUp to TMB

    The updated V1.0.1 release includes the SketchUp files in the PowerPylonModels library.

    Somebody with more 3D modelling experience than I can have a go at optimizing them.


    /Stu


    PS switching from cylindrical to square pylons would probably help


    Great tool! I wonder too if this tool can easily be adapted for other objects e.g. farmhouses.



    Certainly it is possible to process other OSM features. The power lines were sort of low hanging fruit with no current solution.


    Even with a well defined set of features of interest to process there needs to be a way to specify the selection of

    OSM features and mapping to model names.


    We already have (some of) that in scenProc. The PlacePointsOnLineVertices command has the capability to create objects with defined orientation.

    I think the mapping of OSM attribute values to model names is useful because it covers 90% or 95% of the cases without intervention.

    I don't think scenProc has enough flexibility to do that. Also scenProc is missing is the ability to generate the TSC files.


    I am a fan of extracting as much as we can from OSM. I am thinking about an XML configuration file to specify the feature to model mapping.


    I'll have to think if there is a way to generalize this without adding a lot of complexity. I don't want to reinvent scenProc.


    /Stu

    i7-6700K CPU @ 4.00GHz | ASUS Z170-A | 16Gb DDR4 | Samsung SSD 950 PRO NVME M.2 256GB | Samsung SSD 850 EVO 1TB | GeForce GTX 1080 Ti on GP102-A GPU | Oculus CV1 | Windows 10

    Edited once, last by lenidcamper: addendum ().

  • First: it is a great tool and the power pylons add a lot to the VFR experience.


    Such a tool makes me thinking. How can it be used outside of the power pylons.

    So I replaced the pylons in a region north of berne by a swiss alpine hut. The big advantage over ScenProc is that the tool generates a tsc-file. If we can change the arguments ourselves we can extract anything from the osm file and generate a tsc. 'Search and replace by' does the rest. It repeats in this case the model but this is just a first approach.


    Best regards,

    Thomas


    i7-6700K @ 4.0 GHz, Geforce GTX 1080, 32MB RAM, 500 GB SSD, 1 TB SSD, 1TB HD, 32" Monitor 4K, Oculus Rift