Search Unity

UnityFS - Flight Simulation toolkit

Discussion in 'Assets and Asset Store' started by UnityFS, Feb 23, 2013.

  1. FogGobbler

    FogGobbler

    Joined:
    Mar 25, 2009
    Posts:
    147
    Hi,

    any chance UnityFS will have flaps/slats and speedbrake support?

    Thanks and best regards,
    Michael
     
  2. UnityFS

    UnityFS

    Joined:
    Feb 10, 2013
    Posts:
    127
    Hi FogGobbler,
    Flaps are planned for the next update :) I will add speedbrakes to the list!
     
  3. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,113
    Hi Chris, can you add the differential throws for each control surface.
    Having different amounts of movement for both up and down on control axis would be great.
    Looking forward to next release.
     
  4. UnityFS

    UnityFS

    Joined:
    Feb 10, 2013
    Posts:
    127
    Hi John,
    Long time no speak :) Will do!
     
  5. FogGobbler

    FogGobbler

    Joined:
    Mar 25, 2009
    Posts:
    147
    Sounds great, thanks :)
     
  6. FogGobbler

    FogGobbler

    Joined:
    Mar 25, 2009
    Posts:
    147
    Hi,

    if the plane moves too far from the origin it starts to jitter. After some research, I´ve found out that it is the spatial jitter problem that occurs because of floating point inaccuracy. The only solutions I´ve found are

    - scale scene down
    - floating origin

    I´d like to keep my 1 unity = 1 meter scale, so is there another why of avoiding jitter?

    Thanks,
    Michael
     
  7. UnityFS

    UnityFS

    Joined:
    Feb 10, 2013
    Posts:
    127
    Hi Michael,

    Yes - The best way is to reset your scene such that the aircraft is back to the origin after a given threshold such as 6000units/meters. (You will then need to obviously translate the terrain / clouds etc along the same vector so that the aircraft doesn't simply appear to teleport.

    The Kerbal space guys gave an excellent talk on just this issue plus more which can be seen here:
    http://www.youtube.com/watch?v=mXTxQko-JH0
     
  8. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,113
    Excellent Chris, look forward to next set of additions. How is the helicopter module coming along.
    If you need any early testers ;)
     
  9. UnityFS

    UnityFS

    Joined:
    Feb 10, 2013
    Posts:
    127
    Thanks John :)
     
  10. OJDee

    OJDee

    Joined:
    Feb 11, 2014
    Posts:
    43
    First of,all, a great asset, thanks Chris.

    So I am trying out a first aircraft with UFS and I'm experiencing a slight issue that it would be good to clear up.

    Using the basic template I have a single wing using the basic aerofoil, a single tailplane and vertical stabiizer using the NACA 0009 symmetrical aerofoil as per tutorial videos. There are also three identical wheels. All the elements are centrally aligned, ie there are no elements off-centre.

    I have not added any control surfaces at this point.

    On takeoff roll, the aircraft has a slight pull to left and the a left roll once airborne. I have tried to identify if this is a symptom of the physics modelling such as torque roll, but I have not been able to identify the cause. Maybe hard to diagnose, I can share project if need be, but thought I would check to see if this is a known phenomenon caused by some bad setup...?
     
  11. VIC20

    VIC20

    Joined:
    Jan 19, 2008
    Posts:
    2,423
    Check propwash source for mirrored wing
     
  12. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,336
  13. UnityFS

    UnityFS

    Joined:
    Feb 10, 2013
    Posts:
    127
    Very cool! :)

    Edit - I would love to see more Elecman!!
     
    Last edited: May 5, 2014
  14. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,336
    Onto it!

    I have to fix a few things like light attenuation at a distance, shimmering caused by the light being smaller then screen pixel at a distance, making some directional lights, and making a proper CAT I, II, and III lighting system. Will post some more screenshots, web players, and videos once I got that up and running.
     
  15. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,336
    I finished my demo, except for the PAPI. Will post some videos and a webplayer later. For now, here are some screenshots.

    ALSF-2 approach lighting
    $ALSF-2 approach lighting.png

    ALSF2 approach lights in dense fog
    $ALSF2 approach lights fog.png

    Runway end
    $Runway lights end fog.png

    I managed to reduce the light shimmering at a distance by increasing the sprite size a bit as the distance to the camera increases. It also contains some attenuation tweaks and some further trickery to make it look good.

    With some further tweaking, I am sure I can make it look the same as in real life.

    Edit:
    I added a PAPI now as well. There is a small smooth transition between white and red, just like in reality. As far as I know there is not one sim which has actually implemented that color transition. It's the details which get you the "presence" ;-)
    $PAPI.png

    Edit 2:
    Some more tweaks:
    -Disabled light mipmapping.
    -Added some yellow hue to the red lights.
    -Added a bit more blue hue to the strobes.
    -Added a bit more yellow hue to the white lights.
    $approach lights color tweak.png

    Edit 3:
    Web player added.

    Edit 4:
    -New version (1.1) and renamed to MiniSim.
    -Added the baron from UnityFS, courtesy to Chris from UnityFS.
    -Tweaked the lights to provide a more realistic look.
    -Added 3D binaural sound, courtesy to 3Dception from Two Big Ears.
    -Added settings presets.



    Edit 5:
    Added a youtube video:


    Controls:

    -Y = Slew. Turn off the flight dynamics and move freely.
    -Scroll wheel = increase / decrease move speed multiplier when in Slew mode.
    -AW = move sideways in Slew mode, or control Aileron in flight mode.
    -SD = forward / backward in Slew mode, or control Elevator in flight mode.
    -Left and Right arrow = control Rudder in Flight mode.
    -QE = move up and down in Slew mode.
    -R or joystick button 0 = Reset all values and reset Aircraft position if in fly mode.
    -P = Pause.
    -ESC or ALT-F4 = Quit program.
    -C = Camera change. Hide or show cockpit.
    -V = VR mode ON/OFF (not in web player).
    -M or Tab = Menu show or hide.
    -Mouse look = click on screen to turn on or off.
    -Plus or Minus = throttle.

    Theory:

    Scale vs Distance: If lights are far away, they can be smaller then one screen pixel. This causes the lights to shimmer or not show up at all. If this setting is enabled, the further away the light is, the larger the scale. This gets rid of the simmer and light disappearance issue. Also, in real life light sources which are further away appear larger then nearby objects of the same size.

    Emission Gain vs Distance: Lights which are further away should be less bright due to the inverse square law. This is currently not implemented in the bloom shader, so this setting fixes that.

    Global Bloom: increase/decrease the bloom of all lights, regardless of distance.

    Tone Mapping: the exposure time of the camera.

    Lens Dirt amount: post processing special effect which simulates light refractions caused by dirt/scratches on the lens.

    Fog, Time of Day, Field of View: self explanatory.

    Web player link:
    https://dc8b87f2ff00541c88c5157a4db.../0Bwk4bDWv3jAcSzZvTm5qNjBENFE/MiniSimWeb.html

    Standalone Windows (with Oculus rift support):
    https://drive.google.com/file/d/0Bwk4bDWv3jAcYTlyMmZsMmVCa0k/edit?usp=sharing
     
    Last edited: Jul 13, 2014
  16. UnityFS

    UnityFS

    Joined:
    Feb 10, 2013
    Posts:
    127
    That is seriously cool! Very impressed Elecman :) love the webplayer demo!!

    Can I ask what is it for? Do you have plans to incorporate flight into it? A nice foggy night ILS landing challenge would be awesome in that environment :)

    What do you have the glideslope set for on the PAPI? 3degrees?5 degrees?

    Chris
     
  17. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,336
    I made the demo just to see if I could improve the look of runway lights compared to all other simulators. I always was annoyed by the fact that lights in flight simulators always look like colored fluffy cotton, not like actual bright lights. I tried to make a demo before but I never could make it look like anything better. That was until I discovered Sonic Ether's new bloom shader. I am quite pleased with the result.

    I could add a flight option to it, if I can find a suitably easy to use prefab. Perhaps the new Unity assets will do as they contain aircraft.

    The PAPI is set to 3 degrees although it looks like less, but that has probably something to do with the camera FOV.

    Are you planning to make a fully functional flight simulator or just sell UnityFS to allow others to do that? If you are making a full sim, you might want to take a look at the SE bloom shader ;-)
     
  18. UnityFS

    UnityFS

    Joined:
    Feb 10, 2013
    Posts:
    127
    Check your PM's :)
     
  19. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,113
    That is fantastic looking Elecman, very realistic looking. Will looking into getting that bloom shader.
    Will you be posing a guide on how you achieved the look? :)
     
  20. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,336
    @UnityFS,
    Well received.

    @Jonh G,
    Ok, I'll post a guide for that.
     
  21. UnityFS

    UnityFS

    Joined:
    Feb 10, 2013
    Posts:
    127
    I think that deserves a free copy of UnityFS! :)
     
  22. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,336
    Thanks! Some cool stuff coming up :)
     
  23. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,336
    Here is a guide on how to achieve the approach light look discussed previously.

    Web player:
    https://googledrive.com/host/0Bwk4bDWv3jAcTF80TWRPeDliMU0/Web Player.html

    Oculus Rift support:
    https://drive.google.com/file/d/0Bwk4bDWv3jAcZ3JJS1lPajNCMjA/edit?usp=sharing

    Get the Sonic Ether bloom shader from the asset store here:
    https://www.assetstore.unity3d.com/en/#!/content/17324

    Add the Sonic Ether script to the Camera, and below that, add a Tone Mapping script.

    Add a Quad and set the material to use the Sonic Ether/Particles/Additive shader. For the texture, use the Sonic Ether separticle.png file, but modify it with these settings:

    -Alpha from grayscale.
    -Do NOT generate mip maps.
    -Sprite mode NONE (I couldn't get the build in sprite system to work correctly).
    -Filter mode Trilinear.
    -Aniso level 9.
    -Format: automatic compressed.
    -If you can, modify the texture so the white highlight in the center is smaller, with a larger transition on the edge. I did not do this for the demo though.

    Make a few prefabs from the light object with different colors. Then arrange them in a runway lighting configuration. What you will get looks like this:



    As you can see, distant lights are missing. If the aircraft is in motion (which it usually is), it will cause a lot of shimmering as well. This problem is caused by the fact that distant lights are often smaller than one screen pixel. In order to solve the shimmering, we need to scale up lights which are further away. You might argue that this is unrealistic but in fact, in reality distant lights appear larger than neighbouring objects of the same size, as can be seen here:



    Scaling code:
    Code (csharp):
    1.  
    2. float scale = (distance * scaleMultiplier) + 1f;
    3. transform.localScale = new Vector3(defaultScale.x * scale, defaultScale.y * scale, defaultScale.z * scale);
    4.  
    5. //move the light up to workaround the fact that it doesn't draw on top of everything else.
    6. Vector3 vector = Math3d.SetVectorLength(transform.up, transform.localScale.y / 2f);
    7.    
    8. transform.position = defaultPosition;
    9. transform.Translate(vector);
    10.  
    After scaling up distant lights using a linear function, distant lights look too bright. This is because the SE bloom shader does not take into account light attenuation over a distance, otherwise known as the inverse square law.



    FSX has the same problem as can be seen here:



    The runway lights in FSX are generally too bright. Look how bright it is compared to the sun. It looks cool but not very realistic.



    In the demo I used a linear function to reduce the Emission Gain from the Sonic Ether/Particles/Additive shader. It is not quite inverse square law attenuation, but it still looks ok:



    Attenuation code:
    Code (csharp):
    1.  
    2. float emissionGainModified = (distance * gainMultiplier) + emissionGain;
    3. renderer.material.SetFloat("_EmissionGain", emissionGainModified);
    4.  
    Then it is just a matter of tweaking the bloom amount, tone mapping, fog, etc.

    There is work to be done though:
    -Lights should not only attenuate in strength, but also in color, caused by atmospheric scattering.
    -Lights should only heavily bloom at close range in the absence of fog.
    -Lights should be less bright in daytime and more bright at nighttime. In reality lights are the same brightness and only appear less bright at daytime because the surrounding scenery is more bright then at night time.
    -The lights should have a smaller white highlight in the center, and a more sharper color.
    -The light intensity should be dependent on the viewing angle as nearly all lights have some sort of focusing lens.

    Here are a few pictures of real runways to compare with. But keep in mind that a photo does not necessarily represent the real thing. Photos often suffer form exaggerated bloom and lens flare. These photos are pretty close though.





    I will make an update once I have made some more progress.
     
    Last edited: May 18, 2014
  24. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,113
    Elecman thank you taking the time out to write up this tutorial on archiving fantastic looking runway lights.
    Also for the code to acheive those results.
    While I don't have unity pro yet, I will still get the bloom shader and use the trial mode to get it working for now.
    Untill I can get the finances to get a full license.

    Once again excellent work. :)
     
  25. etmgames

    etmgames

    Joined:
    Apr 12, 2014
    Posts:
    11
  26. etmgames

    etmgames

    Joined:
    Apr 12, 2014
    Posts:
    11
  27. UnityFS

    UnityFS

    Joined:
    Feb 10, 2013
    Posts:
    127
  28. Litwin

    Litwin

    Joined:
    Aug 15, 2013
    Posts:
    60
    Any news on updates about helicopter?
     
  29. Frednaar

    Frednaar

    Joined:
    Apr 18, 2010
    Posts:
    147
    Helicopter is substantially finished from the physics simulation side, Chris is putting together the finishing touches to it. We are also adding new features that will benefit aircrafts, and adding good helicopter sample model.

    I let Chris make an estimate on release time...
    bye

    Fred
     
  30. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,113
    Excellent, really looking forward to this release.
     
  31. shwa

    shwa

    Joined:
    Apr 9, 2012
    Posts:
    443
    It's great.
    existing demo in the download works well in unity 4.2.1.

    Trying to figure out how to bring it into an existing project that has multiple scenes.

    (Tried to import directly, export as a package, etc, but the plane functions aren't working.)

    Any quick tips on an effective way to do this?

    thanks,

    shwa
     
  32. rblkwa

    rblkwa

    Joined:
    Jun 20, 2013
    Posts:
    61
    I just recently bought the package. I'm pretty happy about the features. However, at this point i cant seem to get my joystick (HOTAS logitech g940) to properly control the surfaces. It's like a negative value (pushing the stick forward) doesn't seem to work.

    Anyone else experiencing this? Is this a unity bug?

    Thanks for any pointers :)

    stephan
     
  33. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,113
    Had it working with a Thrustmaster Cougar HOTAS, you need to set up the HOTAS under Project Settings - input.
    Create new inputs for each axis of the joystick you require by increasing the Axes Size count, Set Type for each to Joystick Axis, and then assign the relevant axis to each.

    Below shows where I set up secondary controls for each axis, that way original key settings can also be used.

    $Unityfs.gif
     
    Last edited: May 31, 2014
  34. rblkwa

    rblkwa

    Joined:
    Jun 20, 2013
    Posts:
    61
    I tried that, and unfortunatly that didn't work.

    I've got it pretty much mapped like you describe. It just seems all the axis are off. It's almost like the stick isn't calibrated (but it is).

    I found a few threads with the same issues. Cause is directinput and rawaxis data? Might this be the case here aswell?
    http://answers.unity3d.com/question...xis-incorrect-values-problem.html?sort=oldest


    A little update;
    I did some testing, and when i'm using Input.GetAxis("Roll"), it's basically giving output like so:

    When moving the stick right it's like it dividing the axis in two. What i mean is it starts at 1, half way it's 0.5, and switches to -0.5 and goes to -1 when fully to the right. Going to the left does nothing but -1.

    Hope that makes sense to someone :)
     
    Last edited: Jun 1, 2014
  35. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,113
    Have you set up your HOTAS axis limits using windows built in Joystick calibration.
    Maybe if your using the calibration setup software for your HOTAS it may be causing a conflict?
     
  36. UnityFS

    UnityFS

    Joined:
    Feb 10, 2013
    Posts:
    127
    [SUB][/SUB]
    Thanks for offering your assistance here JohnG :) This is a little bit out of my area of expertise as my joystick is pretty simple in comparison however It does sound like it could be a windows calibration issue.


    Regarding uFS Helicopter -

    The flight model is now all done - Fred has done an incredible job! :) I am currently adding the final touches to the custom inspectors/gizmos etc to make the editor side as user friendly as possible. Once done we need to hook up a demo scene, write some documentation and then send it off to Unity for approval - not long :)

    I hope to send out a beta version soon to a small and select number of existing uFS customers so if you are interested in helping out and would like to get your hands on it early please send me an email. John G you are at the top of my list if interested :)

    Thanks,
    Chris
     
  37. rblkwa

    rblkwa

    Joined:
    Jun 20, 2013
    Posts:
    61
    Hi john, chris,

    The issue is not the stick, but unity itself. After some digging i found out that unity doesnt support direct input anymore. For 'simple' controllers this isnt an issue, but HOTAS sticks are issues. Im sure that nobody will be able to map rudders to their pedals (which also is a big issues on the helicopter!)

    Anyway, i did a small plugin using directInput. It will need some work but will get the job done.

    Steve
     
  38. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,113
    @Chris, Yes definitely Interested. PM me the details when its ready for testing. :D

    @rblkwa, It may be unity alright. I've just updated to version 4.5 of unity so I'll rebuild my project and do some testing with my HOTAS to see if the same issue arises.

    After some digging I see that the problem is in relation to whether your joystick/hotas is sending it output as either DirectInput or RawInput.

    Until Unity allow us to configure as one or the other, here is a workaround:

    Taking from http://forum.kerbalspaceprogram.com...ibly-calibrated-Joysticks-in-KSP-(Workaround)






    EDIT:

    Updated to Unity 4.5, and UnityFS and the Thrustmaster cougar work perfectly on all axis.
    Can only say that the Cougar is using RawInput and hence works ok.

    Also came across this may be a solution??
    http://forum.unity3d.com/threads/58016-Joystick-calibration?p=372111&viewfull=1#post372111
    and
    http://forum.unity3d.com/threads/67906-Gamepads-and-GetAxisRaw?p=1624189&viewfull=1#post1624189
     
    Last edited: Jun 2, 2014
  39. shwa

    shwa

    Joined:
    Apr 9, 2012
    Posts:
    443
    UFS -

    Edit: i key changed in input settings.

    Hi,

    m and i keys.

    I need to change the keys for restart and ignition, as i use those for other functions in a larger project.
    Where in the code can i find these settings?

    thanks.
     
    Last edited: Jun 10, 2014
  40. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,113
  41. shwa

    shwa

    Joined:
    Apr 9, 2012
    Posts:
    443
    THanks John G, but i don't see the m key for restarting the scene.
     
  42. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,113
    Hi shwa, don't think UnityFS has a "Reset Scene function" is it possible this belongs to another asset?
    m has no effect in the unityfs/demo scene on my end.
    These are the default keys:

    • Pitch Up/Down – W,S
    • Roll Left/Right – A,D
    • Rudder Left/Right – Q,W
    • Throttle Down/Up – 1,2
    • Change Camera – C
    • Brake – B
    • Ignition – I
     
  43. shwa

    shwa

    Joined:
    Apr 9, 2012
    Posts:
    443
    Thanks, John G.
    i think the m key functionality was old code of mine sticking around a scene.
     
  44. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,336
    I noticed that the artificial horizon of the default Baron snaps to the straight and level position when the aircraft is close to that orientation. This is probably caused by the Euler Angle code used in AttitudeIndicator.cs.

    It is better to avoid Euler Angles all together, especially in simulators. This code works much better:

    Code (CSharp):
    1. Vector3 heading = transform.root.forward - (Vector3.Dot(-transform.root.forward, Vector3.up) * Vector3.up);
    2. transform.rotation = Quaternion.LookRotation(-heading.normalized, Vector3.up);
    Last thing to do is edit the ai.png file (horizon texture) and flip it upside down.
     
    John-G likes this.
  45. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,113
    Tks Elecman for that great tip.
     
  46. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,336
    No problem.

    By the way, I updated a new version of the approach lights demo. See my previous post. You can actually fly around now :)
     
    John-G likes this.
  47. Cjmarkham

    Cjmarkham

    Joined:
    May 30, 2014
    Posts:
    41
    Is there anyway to have it so the plane starts in the air rather than having to take off?
     
  48. venusboysatish

    venusboysatish

    Joined:
    Jul 10, 2012
    Posts:
    25
  49. blpfaff

    blpfaff

    Joined:
    Sep 10, 2013
    Posts:
    6
    Hi. This is a great simulator, but I am having a problem. I am experimenting with different models, and pulled in what I think is the correct model for the Cessna 170B (it looks like the same model used in the tutorials. Same markings, aircraft ID, etc.). I pulled it from the X-Plane user forum (free download) and imported everything associated with it into Unity. I have rigged it thru tutorial 4, but cannot get it to fly. It does not even move. Perhaps I am not using the right model? Can you tell me where you got your Cessna from? At this point I am grasping at straws, and any help would be appreciated.

    Barry Pfaff
     
  50. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,113
    Are any of your control surfaces responding to key input, turn on gizmos for visual acknowledgement if 3d model not hooked up correctly.

    If no movement to input, Check you copied in the correct input file.