Friday, July 26, 2013

Microsoft Flight Simulator X (FSX)

Fix by Bo3b

Fixed:

Removed the screen depth lights on runways, towers, beacons.

BEFORE: 


AFTER:


Description:

FSX is one of the top flight simulators, and works fairly well in 3D.   Convergence and depth work well.

The lighting effects have always been a problem, and dramatically detract from the experience in 3D, because all lights are at screen depth.

This fix is marginal, because it only deletes the light effects and aircraft labels.  That means that day flying is now pretty good, but night flying loses all the runway lights.  Maybe pretend that it's an airport power failure.

How to install (this is not a Helix mod):

0) This only works for the SP2 version of FSX.

1) Use the standard FSX profile.  Other profiles were tested, but don't solve the problem.

2) Rename "..\Texture\halo.bmp" to "original halo.bmp" to disable runway lights.

3) Rename "..\Effects\texture\fx_2.bmp" to "original fx_2.bmp" to disable beacons.

4) Go to Settings->Customize->Traffic and uncheck "Show aircraft labels" to disable red text over other airplanes.

---------------------------

I'm still looking into a fix, instead of just deleting the effect, but it's not promising.

Microsoft coded all graphic effects in a 2D library 'g2d.dll'.  The effects appear to be hard coded and are done after the 3D pipeline has completed.  There are no vertex shaders associated with the effects, and the items in the 3D models that are used for placement are not visible.

The effects for sun, moon, fireworks, and smoke also have the same problem.  I did not delete them, because of their rarity.  It should be possible to delete other graphic files if that seems worthwhile.

22 comments:

  1. Not sure if this would work, but try using the trick whereby a scene depth map sampler can be re-used in another shader by specifying it in the dx9settings.ini file. This is the technique for making a cross hair dynamic. Am on iPhone right now else would post the settings and example code - look in the bioshock fixes. Biggest pain will be finding a sampler that can be re used and it might not be possible.

    ReplyDelete
    Replies
    1. Thanks for that suggestion. That's not a bad idea. I'm still trying to find something that will give me the original position of the lights, and I might be able to get something through the HLSL folder, now that I disabled the obscuring and bad light effects. The HLSL folder includes all of the non-effect code, and can possibly be used to find the depth map.

      Delete
  2. Replies
    1. No improvement, sorry. I'm pretty sure that the current lights and fog effects are not fixable, because they are run through a specifically 2D library that doesn't use shaders to change the screen. There are no shaders that HelixMod can see, and I looked at all of the HLSL code and nothing is used there as well. As near as I can tell, it's C code directly changing the display buffer. Possibly an artifact of its ancient heritage.

      The only last thing to try would be to substitute the broken lights with known working lights. I know that some 3rd party mods have working lights, but I'm not willing to pay for them.

      Delete
    2. I tried messing around with FSX and 3D Vision as well, since I would really like it to work. At this moment I disabled many lights as described in this fix. I also disabled the stars and moon, especially the stars were bad since they are everywhere in the sky.

      I am willing to pay for any add-on which fixes lights and stuff. Bo3b, you are saying to know some add-ons which fixes the lights? Could you please name those add-ons for me :-). Preferably an add-on which fixes lights from all the runways inside FSX, not just some specific airport.

      Delete
    3. Actually, I did find out that this cannot be fixed by normal techniques. Their 2D library is a non-starter for the runway lights. (and smoke effects) I did not dig into which add-ons would work, so can't help there.

      However, I did see that FlyInside had successfully fixed these for VR, and I contacted him about it. Turns out he did a complicated math calculation to get the 2D location back to the proper 3D eye, while remaining 2D. Artificially moving the location himself. So... can be done, but basically requires making that 2D library 3D. This is beyond shader hacking into rewriting that library.

      For this old version, I don't think that's worth the effort. Especially given that FlyInside works so well in VR. The resolution is not awesome, but the FlyInside VR version is the way to go.

      Delete
    4. This comment has been removed by the author.

      Delete
    5. Ok, thank you very much for your detailed reply! Yes, I was wondering about FlyInside as well. But I am actually waiting on better VR devices with higher resolution.
      Also I am afraid of not being able to use my other devices, like iPad, anymore when using VR. I have to take off the VR set everytime.
      But if the VR is so great I might do not care anymore :-).

      So do I understand you correctly, is FlyInside working really well with FSX? I might start buying those VR devices then for some testing.

      Delete
    6. Yes, FlyInside works great with FSX. I've used only the original CD rom version patched up to SP2 though, not the all-in-one Steam version. But I'd be surprised if it didn't work really well. The guy building it is very good. I was an original Kickstarter backer for him.

      It's surprisingly good. The immersion is very impressive. If you can crank up the supersampling with overpowered GPU, you can reduce the low-res impact. FSX is an antique and single threaded, so it's nearly certain to be CPU bound anyway.

      Delete
    7. Happy to hear this since I was almost buying 3x 27inch 3D monitors for 3D Vision surround :). I will try some VR first now... I am running GTX 1080 SLI so GPU power will not be a problem.

      Which VR kit would you recommend? I noticed the Vive Pro with a bit higher resolution.

      Delete
    8. Definitely give VR a try first. You can also Surround later if you find it to clumsy or bad. Rift is cheapish at $400 new. Buying used is OK too.

      FlyInside supports WMR too, and you can get those super cheap, like $150 or $100 used. I would not do Vive Pro because it's stupid expensive right now. You can match resolution with Samsung WMR at $400 on sale.

      My best guess: Go with Rift for FlyInside, because it supports the Oculus ATW, which allows for lower frame rates, without making you sick. FSX will be CPU bound, and ATW *really* helps for this scenario.

      Also consider moving to a more modern flight sim, but that's a big change and lots of factors. But FSX is ancient by today's standards, and will never properly support multi-core CPUs.

      Delete
    9. This comment has been removed by the author.

      Delete
    10. Just talked to the flyinside dev...

      so I believe the lights in FlyInside FSX are not actually 3d (correct me if I'm wrong here), but rather drawn at infinite depth. It just looks "OK" because stereo-depth perception doesn't do much once you get past 20-30 feet for something of that size
      I don't believe that lights render "at depth" in FlyInside FSX?
      What we do do, is duplicate the geometry and draw at the same position for both eye (same w/ sun, moon, etc)
      float originalFovY = s_currentHooker->m_fsxFovY, newFovY = s_currentHooker->m_ocFovY;
      float originalFovX = s_currentHooker->m_fsxFovX, newFovX = s_currentHooker->m_ocFovX;


      float xOldCenter = (float)vpOrig.Width / 2, xOldSize = xOldCenter;
      float yOldCenter = (float)vpOrig.Height / 2, yOldSize = yOldCenter;
      float xNewCenter = s_currentHooker->m_camera.getScreenRenderSize().w / 4.0f, xNewSize = xNewCenter;
      float yNewCenter = s_currentHooker->m_camera.getScreenRenderSize().h / 2.0f, yNewSize = yNewCenter;

      for (std::size_t i = 0; i < NumVertices; i++)
      {
      float xPercent = (data[i * 8] - xOldCenter) / xOldSize;
      float xAngle = xPercent;
      data[i * 8 + 0] = xAngle * newFovX / originalFovX * xNewSize + xNewCenter;

      float yPercent = (data[i * 8 + 1] - yOldCenter) / yOldSize;
      float yAngle = yPercent;
      data[i * 8 + 1] = yAngle * newFovY / originalFovY * yNewSize + yNewCenter;
      }
      I'm intercepting the draw call (I believe it's DrawIndexedPrimitiveUP), and modifying the geometry before it gets passed to the GPU
      So if you can find the right person to code it, that should be helpful

      Delete
    11. Interesting tidbit on how he solves the problem. Rewrote the 2D library, but only for that one call. It works pretty well, and is doing the same thing we do with 3D Fixes, by moving an image from screen depth back to 3D depth. I do notice that the image wobbles slightly as you turn your head, but is not really annoying.

      I did try current FlyInside and FSX SP2, and it's working fairly well, but has a strange performance glitch that is annoying. Every 30 seconds or so, there is some sort of a stall, and it drops frames. If ASW is enabled, it will spin down to 45Hz, then back up to 90. It's noticeable and annoying. Given that they are no longer really communicating, this might be a deal breaker if no solution can be found. You can most easily see the glitch using the Oculus Performance monitor and/or their Frame Drop Indicator in the Debug tool.

      Delete
    12. I found Flyinside pretty much unplayable due to horrible micro judder no matter what settings and hardware.
      Like low altitude flying past scenery objects looking left or right and they are passing by jerky and stutter
      Some people have learned to deal with it...I cannot

      Delete
    13. As a data point, I think this can work, but there is of course a lot of complexity. Looking into this problem, it seems fairly clear that the latest Nvidia drivers have damaged this scenario. I DDUed back to the 388 branch, 388.71, last known good branch. My system: 8700K, 1080ti, Win10 1803, 16G, 900p boot drive. Oculus Rift. Clean reinstall of FSX and FlyInside to boot drive. Default settings for both. 3D Vision disabled.

      With this high end setup, I'm getting good results. No frame drops like above, and I don't see any stutter when flying close to the ground. Nothing I would call microstutter. I use the Oculus Debug Tool to show the performance monitor, and there are no lost frames counted, and something like 90% headroom available.

      Your mileage will of course vary, but I think it's important to note that this can work. Maybe try to match this setup as close as possible. Starting with a known good spot and tweaking it, is superior to hitting a lot of options and trying to get it back to functional.

      Most important piece seems to be the video driver.

      Delete
    14. I think maybe I see what you are seeing. Hard to describe, but it's not what we would normally call microstutter. Maybe stutter is the best description. It looks like the ground has a lower frame rate than aircraft or headset, and makes little jumps instead of being smooth. Like each frame jumps ahead by 3 feet when looking to the side.

      I'm not sure how to see FSX frame rate itself. I'm not seeing dropped frames at all in Rift, and the headset is clearly running at a full 90Hz. I'm just not sure the game actually is. If I enable the frame rate indicator in 2D, it seems like it has plenty of headroom, but visually it looks like FSX is dropping frames.

      I can dramatically improve this by setting game frame rate to 45 or 90. Infinite does not work very well, that seems to set up a beat frequency between the headset and the game, which is maybe where the stutter comes from. Not flawless at 45, still occasional stutters, but not like a standing wave.

      Delete
    15. Yes I have the same GPU/CPU and Ill definitely try 388.71 drivers and put frame limit to 45 or 90.
      It such a beautiful experience with Flyinside

      Delete
    16. So I tried FlyInside as well with the latest NVIDIA drivers (current 416.34) and a GTX 1080 (Intel 6850K with 32GB both heavily overclocked). For me it is running really well and I do not see any issues. I only did the first missions though and still have to test a more long flight, but mostly using the first missions for testing performance works great for me. The only thing I noticed is that when I have SLI enabled things go really bad, I have to disable SLI (worthless anyways with the Rift...). I can easily run it with SuperSampling set to 2.0 in the Oculus Tray Tool and yes indeed, that fixes quite some low-resolution issues. My FPS is always 90 in the Oculus performance display.
      Did you solve your issue already MrSilent? I also spend allot time in tweaking the FSX.CFG and will be happy to share it if you would like or any other system details.
      Thanks again for the great suggestion Bo3b! I will probably do not put any more money into 3D Vision… This is indeed really awesome and a great experience!

      Delete
  3. Thanks allot Bo3b! Yes, I was researching allot and thought the Rift would be the best option as well. It is cheap and most compatible. Especially since you say it as well, I have even more confidence. If I do not like it I will get surround anyways. Then I have both :-).

    I also noticed you can pull in any desktop application into FlyInside, so I do not require any other computer or iPad. FlyInside is looking really good (except for the part that they do not seem to communicate well anymore...).

    Yes, I know FSX is old. But it is still really well supported and I have many add-ons. It runs quite good on my computer, I have tweaked allot and mostly have 50+ FPS. My CPU has quite good single core performance. I just started playing again after a 3 year break, once I get the hang of it again I will get P3D as well.

    I found a really great performance tweak for FSX. At least it works great for some people including me. If you are interested it is described here: https://steamcommunity.com/app/314160/discussions/0/620703493312427477/.

    But still, you are right and I will move anytime soon :-).

    ReplyDelete