Outerra forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Outerra Tech Demo download. Help with graphics driver issues

Pages: 1 2 3 [4] 5 6 ... 15

Author Topic: Integrating with another sim  (Read 110061 times)

langdon

  • Full Member
  • ***
  • Posts: 110
Re: Integrating with another sim
« Reply #45 on: October 29, 2015, 08:58:39 am »

Hi again,
I've actually got a plugin now that takes FSX / P3D output (via fsuipc) and drives the Outerra engine via the OT_API.... almost.

Everything is almost ok around the equator but I've got some kind of weird problem with pitch being wrong the further I move away from the equator..either North or South.
I don't think it's my code creating the issue because even if I hard code ECEF values as per the example igc_plugin.dll and rotate the heading from 0 to 2PI (0-360 degs) it seems like its not rotating around a 'normal' to the planet surface. Am I missing something? Do I need to compensate in my code for this change in position?

Code:
void llaToWorld(double lat, double lon, double alt)
{
   double rad = 6378137; // radius
   
      lat = lat * (M_PI / 180.0);
      lon = lon * (M_PI / 180.0);

      double f = 0.0; //flattening
      double ls = atan(pow((1.0 - f), 2) * tan(lat));    // lambda

      double x = rad * cos(ls) * cos(lon) + alt * cos(lat) * cos(lon);
      double y = rad * cos(ls) * sin(lon) + alt * cos(lat) * sin(lon);
      double z = rad * sin(ls) + alt * sin(lat);

         ecef[0] = x;
         ecef[1] = y;
         ecef[2] = z;
   
}

then later:

startPos = double3(ecef[0], ecef[1], ecef[2] );

double dtr = M_PI / 180.0;

quat startRot = set_heading_pitch_roll(startPos, float3((playerHeading*dtr), (dtr*playerPitch), (dtr*playerBank)));

this->set_pos(startPos, startRot);


this shows the effect:
startPos = double3(-2286686.1965365410,-3734648.0835802061,4638811.4431277402);
quat startRot = set_heading_pitch_roll(startPos, float3(0, 0, 0));

this->set_pos(startPos, startRot);      


Any clues or even a link to a clue would be really appreciated.

Thanks,
Langdon
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: Integrating with another sim
« Reply #46 on: October 29, 2015, 03:02:21 pm »

Function set_heading_pitch_roll was extracted to the example a long time ago, not sure what state it's in. There are quat_from_hpr and hpr_from_quat methods in <ot/glm/glm_ext.h> that you could use instead. These require the correct up vector for given ECEF  position, which is simply a normalization of the position.

  quat rot = glm::quat_from_hpr(float3(glm::normalize(pos)), hpr);

You need to compute a new rotation quaternion when the position changes.
Logged

langdon

  • Full Member
  • ***
  • Posts: 110
Re: Integrating with another sim
« Reply #47 on: October 29, 2015, 11:56:32 pm »

Thanks dude... works great now.

quat rot = glm::quat_from_hpr(float3(glm::normalize(startPos)), float3((playerHeading*dtr), (dtr*playerPitch), (dtr * -playerBank)), true);

this->set_pos(startPos, rot);

Now I fire up FSX/P3D and Outerra and I can use Outerra graphics in my simpit.
It's 'rough as guts' (Australian expression) but if anyone wants to see it work just drop the dll in the plugins folder.
get the dll here:
http://www.siliconroad.com.au/fsx_plugin.zip

Something weird I noticed is that sometimes, when alt-tabbing between Outerra and FSX my joystick disconnects. The work around is just pull it out of its current usb slot and plug it in another.


Any chance of a bulk importer of objects and/or roads in the near future ?
I know the FSX and Outerra terrain meshes don't exactly align (pretty damn close in a lot of places I've tried though. Happily surprised) but if I could import all the worlds runways (db's are freely available), it'd be a great starting point.

'If you build it, they will come' ... but I imagine you guys have already witnessed that!

Love your work..It's a great future.

Now I'll load up an ultralight, put on my DK2 and enjoy a lovely sunset flight.

Thanks guys!

Langdon
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: Integrating with another sim
« Reply #48 on: October 30, 2015, 01:58:13 am »

Great job.

Any chance of a bulk importer of objects and/or roads in the near future ?
I know the FSX and Outerra terrain meshes don't exactly align (pretty damn close in a lot of places I've tried though. Happily surprised) but if I could import all the worlds runways (db's are freely available), it'd be a great starting point.

Both are being worked on. We are fixing the global OSM road import and adding possibility to add object placement during the import.
We also want to import the runways from a better source than OSM, what dbs are you referring to?
Logged

Acetone

  • Hero Member
  • *****
  • Posts: 963
    • Youtube channel
Re: Integrating with another sim
« Reply #49 on: October 30, 2015, 04:46:30 am »

Really nice langdon :)

I don't have FSX around so just a question : your plugin is extracting FSX plane position/orientation right? You don't have the entire plane/animations/systems visible in OT?
If you have the possibility to do it, a video would be really nice :)
Logged

langdon

  • Full Member
  • ***
  • Posts: 110
Re: Integrating with another sim
« Reply #50 on: October 30, 2015, 05:28:32 am »

@cameni 
The site for the data I was referring to was:
http://ourairports.com/data/

But if it was just me and because I own a copy of fsx/p3d I would just use a program called MakeRunways and extract all of the runway info etc. out of FSX/P3d

I've done that and you are welcome to download a copy of the program (its free. comes with the FSUIPC sdk) and the data I extracted from my copy of P3D v3. The data would be copyrighted but I don't see the harm in using it if I own a copy of P3D. Lots of other FSX/P3D addon developers make use of it this way (eg. Radar Contact)

Its here: http://www.siliconroad.com.au/makerunways_with_data.zip 

Lots of good data in there. Particularly the xml.

@acetone
Not sure if you know FSX well but there's an addon called FSUIPC that extracts data from FSX/P3D. It comes with an sdk that basically allows me to work with it.
You're right, I don't have all the aircraft animations etc visible in OT. What I do have is all the cockpit systems working on one monitor and the outside world (OT) showing across 3 others. The beauty of FSUIPC is that it connects with WideFS which in actual fact allows me to run my 'cockpit visuals' on one pc (a really low end pc) and then via a network have OT showing outside visuals on a completely different pc (high end, good gfx card etc).

There's a lot of conversation about having the meshes between FSX and OT sync'd but in reality, you're not supposed to get that close to the terrain anyway unless you're near a runway.

I'll try and make a video of what I've achieved but its really less than 50 lines of code :)

Langdon
Logged

langdon

  • Full Member
  • ***
  • Posts: 110
Re: Integrating with another sim
« Reply #51 on: October 30, 2015, 05:33:03 am »

@acetone

I  just checked out your scenery mods... holy crap! That's some seriously awesome work! You've really the scenery guru.

L
Logged

Acetone

  • Hero Member
  • *****
  • Posts: 963
    • Youtube channel
Re: Integrating with another sim
« Reply #52 on: October 30, 2015, 06:27:14 am »

@acetone
Not sure if you know FSX well but there's an addon called FSUIPC that extracts data from FSX/P3D. It comes with an sdk that basically allows me to work with it.
You're right, I don't have all the aircraft animations etc visible in OT. What I do have is all the cockpit systems working on one monitor and the outside world (OT) showing across 3 others. The beauty of FSUIPC is that it connects with WideFS which in actual fact allows me to run my 'cockpit visuals' on one pc (a really low end pc) and then via a network have OT showing outside visuals on a completely different pc (high end, good gfx card etc).

There's a lot of conversation about having the meshes between FSX and OT sync'd but in reality, you're not supposed to get that close to the terrain anyway unless you're near a runway.

I'll try and make a video of what I've achieved but its really less than 50 lines of code :)

Langdon
@acetone

I  just checked out your scenery mods... holy crap! That's some seriously awesome work! You've really the scenery guru.

L

Thanks ! It's really interesting. About the scenery, these are made with Gmap so in theory locations and airports are accurate, but I wonder if you could land a FSX plane in one of these airports, that could be an interesting test to see it's possible to have landings sync too. In general, the runways orientation is not perfect in my sceneries (sometimes 1° of difference) but the biggest problem could be the elevation.
I guess that the only option to have these working perfectly fine would be to use the same database for airports in both FSX/P3D and OT, but right now only hand made content is possible.
Logged

John514

  • Hero Member
  • *****
  • Posts: 543
  • Certified TARDIS driver.
Re: Integrating with another sim
« Reply #53 on: October 30, 2015, 06:48:54 am »

But the runways have to be projected on OT terrain, rather than being made with absolute elevations from the runway data, because that would make them cut and raise terrain to extreme levels, or even make them just spawn in a pit in the ground!
Logged
You mustn't be afraid to dream a little bigger, darling

Note: I do not claim to know everything.
I just like to help people around the forum.

langdon

  • Full Member
  • ***
  • Posts: 110
Re: Integrating with another sim
« Reply #54 on: October 30, 2015, 08:33:15 am »

This is interesting...
isn't it from the same NASA data that you guys at Outerra use?

http://www.avsim.com/topic/467959-freemesh-x-freeware-worldwide-mesh-upgrade-p3dfsx/
Logged

dbb

  • Jr. Member
  • *
  • Posts: 10
  • newbie
Re: Integrating with another sim
« Reply #55 on: October 30, 2015, 10:03:47 am »

We also want to import the runways from a better source than OSM, what dbs are you referring to?
At least in the US the FAA publishes this data freely. From here if you do a search for all regions, all districts, etc. You'll be taken to a page with "Data Downloads" which will provide airport and runway data in CSV formatted files. All the necessary data should be there to properly place runways. The National Flight Data Center may contain other useful information, especially under NASR. Internationally, it's probably possible to get access to the AIRAC data that's used for flight management systems and whatnot.

There's also the X-Plane Scenery Gateway for user submitted airport sceneries. The data is obviously in a format to be used by X-Plane, but the data itself is licensed under the GPLv2.
Logged

langdon

  • Full Member
  • ***
  • Posts: 110
Re: Integrating with another sim
« Reply #56 on: October 31, 2015, 03:20:20 am »

Quick question...
Is there a way to get the current ECEF (or LLA) position out of Outerra via the IGC interface?

eg.. is there a get_pos(double3); ?

Thanks.
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: Integrating with another sim
« Reply #57 on: October 31, 2015, 01:45:09 pm »

It's there as pos() method. Header igc.h contains all methods available to IGC, documented.

Code: [Select]
    ///Set camera position
    //@param ecef position in ECEF coordinates
    //@param rot camera rotation into OT view space (-z forward, +y up, +x side)
    void set_pos( const double3& ecef, const quat& rot );

    ///Get current camera position in ECEF
    const double3& pos();

    ///Get current camera rotation in OT view space (-z forward, +y up, +x side)
    const quat& rot();

    ///Get info about current position & speed
    void info( ifc_out ot::igc_data& data );

    ///Test intesection of ray with terrain
    //@return 0 if the ray does not intersect
    //@return 1 if intersects
    //@return 2 if intersects but the starting point is below the terrain
    //@param from starting position of the ray to test
    //@param to ending position of the ray to test, note: keep the ray as short as possible
    //@param pos surface position at the intersecting point
    //@param norm surface normal at the intersection
    //@param dist distance from the starting point to intersection
    int intersect( const double3& from, const double3& to, ifc_out double3& pos, ifc_out float3& norm, ifc_out float& dist );

    ///Set world time for current location
    //@param dyear day of year
    //@param tday solar time of day
    //@param flowm time flow multiplier, 1.0 normal time flow
    void set_time( int64 dyear, double tday, float flowm = 1.0f );
Logged

langdon

  • Full Member
  • ***
  • Posts: 110
Re: Integrating with another sim
« Reply #58 on: November 04, 2015, 05:34:25 am »

Thanks,

Any chance at pointing me to some info on how to convert UTC to Solar Time?

And do you guys start counting days from 0 AD or some other date?

Thanks,
L
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: Integrating with another sim
« Reply #59 on: November 04, 2015, 06:43:56 am »

Solar time has 12AM with sun at zenith, so you basically need to subtract msec_per_day * radians(longitude) from UTC time (in msec).

I think at the moment we are counting days from the beginning of current year, but it will likely change the whole thing to UTC soon.
Logged
Pages: 1 2 3 [4] 5 6 ... 15