Jump to content
Sign in to follow this  
MattNischan

DX10 Rain Fix Shader (Surround Too!)

Recommended Posts

Hello all,

 

I recently purchased another monitor and a GTX680 to utilize a triple monitor Surround/Eyefinity setup. All was well, until I saw the rain. Wow! What an awful effect. And, furthermore, the rain graphic was not nearly filling the entire drawing surface at certain angles, especially in spot view.

 

Basically, it looks like the rain effect is very simple. FSX simply draws a transparent cylinder that is always transformed to screen space. This cylinder is textured with a repeating series of small rain textures which are scaled lengthwise to the rain intensity as well as moved along the surface of the cylinder a bit each frame. FSX then rotates this cylinder based on various inputs, such as wind direction, aircraft velocity, and camera movement. All in all, the effect is pretty darn terrible, but given the limited number of inputs passed in to the shader, there's not a whole lot that can be done.

 

However, I was able to fix a few problems. Firstly, the rain cylinder will no longer be cut off at extremely wide resolutions. The problem was that the cylinder was intersecting with the camera plane, and therefore clipped. I also incorporated the prior suggested fix for the opposite problem, which is when the cylinder intersects with the environment and gets clipped. The solution in the first case was to scale the rain cylinder 4x in the x and y directions, and in the latter case to disable z-buffer tests.

 

I also took the liberty of decreasing the opacity of the rain a touch as well as making the streaks a little smaller. This reduces the "millions of fat laser beams" effect. At very wide exterior zooms this looks marginally worse than the original, and better in pretty much all other cases.

 

I have attached the .fx file. Place it into your ShadersHLSL\misc\ folder in your FSX install. Be sure to make a backup of the original as well as delete the DX10 shader cache before running FSX. The shader cache can be found in your Windows user folder, under AppData (Application Data in XP), then local\Microsoft\FSX\. Just remove the Shaders10 folder and FSX will rebuild the shader cache.

 

You can find the file here: http://www.sounduit.com/rain40.zip

 

-Matt

Share this post


Link to post

Sounds good Matt thanks. :smile:

 

I could not download as it was declined.


Steve Waite: Engineer at codelegend.com

Share this post


Link to post

Old rain effect screenshots attached.

 

You can see how the rain cylinder is cut off, and pretty badly in spot view. Also note the hyperspace effect.

 

And here's the new shader.

 

As an added bonus, it seems that the increased size of the cylinder greatly reduces the hyperspace effect. All the shots were taken from the same flights at roughly the same speeds.

 

Sounds good Matt thanks. :smile:

 

I could not download as it was declined.

 

Sorry about that Steve, I have updated the link.

Edited by firehawk44
Images removed as they exceeded 1600W and/or 400KB limits. Please repost again at 1600 pixels.

Share this post


Link to post

Hi Matt,

It seems to be called rain40_zip, can you rename it to rain40.zip to save it causing issues?


Steve Waite: Engineer at codelegend.com

Share this post


Link to post

Be sure to make a backup of the original as well as delete the DX10 shader cache before running FSX. The shader cache can be found in your Windows user folder, under AppData (Application Data in XP), then local\Microsoft\FSX\.

 

Great fix Matt.

 

FSX DX9 has the same problem.

Will this fix it as well?

If so is the procedure the same?

 

P3D also still has this problem.

 

Thanks,

gb.


YSSY. Win 10, 6700K@4.8, Corsair H115i Cooler, RTX 4070Ti, 32GB G.Skill Trident Z F4-3200, Samsung 960 EVO M.2 256GB, ASUS Maximus VIII Ranger, Corsair HX850i 850W, Thermaltake Core X31 Case, Samsung 4K 65" TV.

Share this post


Link to post

OK, great work indeed Matt.

 

However, I think the rain is way too small, can hardly see it. The original is much better in that respect.


Steve Waite: Engineer at codelegend.com

Share this post


Link to post

Hi Matt! I hafta say - it's great to see another programmer get his teeth into some of the issues that still remain - so a big "Thank You"!

I don't know whether you've read the How-To doc - perhaps not, as there has been a "Rain Fix" for a few years now - done by Aces Team member "Gizmo". It works, but still has that Umbrella effect, but otherwise it's good and quite realistic. Both rain and snow do have that "laser" effect once one gets over ~ 60.

 

I have a few pics now posted here, comparing both fixes, taken around the Orbx "Swanson" scenery.

The first few shots in each set are taken from inside one of the hangars, and one can clearly see the difference between yours and Gizmo's: yours are in, close to the aircraft, and looks far better. Both sets rain inside the hangar, and while some folks might get upset - it does this in DX9, too, so we can ignore it - right!

Once one is flying some other differences become apparent, but I'll let you see what that difference is. Check the airspeed around the four or five shots at 2012-12-5-11-3-32-821 in yours, and the same four or five shots - 2012-12-5-10-45-42-910, and then look at the angle of the rain with respect to the head position in each set.

 

There is another small problem, too, and it's the small snow flakes at low or zero airspeed: they move upward, while the longer "streaky" flakes move downward in a normal manner.



i7 4790K@4.8GHz | 32GB RAM | EVGA RTX 3080Ti | Maximus Hero VII | 512GB 860 Pro | 512GB 850 Pro | 256GB 840 Pro | 2TB 860 QVO | 1TB 870 EVO | Seagate 3TB Cloud | EVGA 1000 GQ | Win10 Pro | EK Custom water cooling.

Share this post


Link to post

Great fix Matt.

 

FSX DX9 has the same problem.

Will this fix it as well?

If so is the procedure the same?

 

P3D also still has this problem.

 

Thanks,

gb.

 

It should fix it for both, but I have not tested DX9. The shader cache for DX9 is just "Shaders" instead of "Shaders10", so you would delete that instead.

 

 

OK, great work indeed Matt.

 

However, I think the rain is way too small, can hardly see it. The original is much better in that respect.

 

What resolution are you playing at and at what precipitation level?

 

-Matt

Share this post


Link to post

I had heavy rain, same test exact same weather. 1920x1200


Steve Waite: Engineer at codelegend.com

Share this post


Link to post

Steve, Paul,

 

Could you guys download the file again and test? I have made a few alterations that should fix the issues you both described.

Share this post


Link to post

Sorry to take so much time getting back to you. Matt - I was playing with the rain/snow colour - 3, 4, or 5 - all are ok.

 

This time I think she's good. The issue is how far does one need to go. The snow is much more realistic - the small flakes are better, but still seem "light" and "floaty", and I have no complaints about the rain. I would like to see a "heavier" rain, though, but I think that is beyond a shader tweak, and gets, maybe, into a change of texture? I think this is what SteveW was alluding to, in his post.

Sitting on the ground one gets the true sense of not wanting to leave the aircraft! It's pouring down! However - as she starts rolling, the intensity of the rain lessens, to the degree that it's "just a light shower", whereas, switching it to snow - it becomes a full-fledged blizzard! Perfect!! Almost blind flying!

Is there any way to boost the rain to get that same effect once airborne?



i7 4790K@4.8GHz | 32GB RAM | EVGA RTX 3080Ti | Maximus Hero VII | 512GB 860 Pro | 512GB 850 Pro | 256GB 840 Pro | 2TB 860 QVO | 1TB 870 EVO | Seagate 3TB Cloud | EVGA 1000 GQ | Win10 Pro | EK Custom water cooling.

Share this post


Link to post

Hi Matt,

 

Thanks! It looks great!

 

Best regards,

Jim


Jim Young | AVSIM Online! - Simming's Premier Resource!

Member, AVSIM Board of Directors - Serving AVSIM since 2001

Submit News to AVSIM
Important other links: Basic FSX Configuration Guide | AVSIM CTD Guide | AVSIM Prepar3D Guide | Help with AVSIM Site | Signature Rules | Screen Shot Rule | AVSIM Terms of Service (ToS)

I7 8086K  5.0GHz | GTX 1080 TI OC Edition | Dell 34" and 24" Monitors | ASUS Maximus X Hero MB Z370 | Samsung M.2 NVMe 500GB and 1TB | Samsung SSD 500GB x2 | Toshiba HDD 1TB | WDC HDD 1TB | Corsair H115i Pro | 16GB DDR4 3600C17 | Windows 10 

 

Share this post


Link to post

Paul,

 

The only change from stock now is the umbrella fix from Gizmo and an increase in the size of the rain cylinder. I haven't made any other changes, so it should appear quite like the original effect, just now big enough to cover the whole widescreen setup.

 

Unfortunately, the application only passes very few variables to the shader, namely the usual vertices and texture info, and a texture transform. This transform is passed in to the shader once per frame and that "moves" the rain textures along the cylinder. So, I can make the rain bigger or smaller, faster or slower. That's about all the control I'm going to be able to have.

 

The rain textures are amazingly tiny, like 8x8 pixels. They just happen to be stretched quite far by the texture transform, which seems to be dependent on things like airspeed and precipitation amounts. That stuff I can't control from inside the shader. Light direction isn't even passed in, so I can't do anything fancy with that either.

 

I just got your PM Paul. You're more than welcome to add the shader to the master doc!

 

Jim,

 

Glad it works for you!

 

-Matt

Share this post


Link to post

OK. Fair enough, Matt. It's in the doc. Let us know of any other changes find. (Don't stop here, keep at it!)

 

Yes - it looks very, very good in close when compared to the older one. The sound is right, too.. reminds me of a summer day in England......



i7 4790K@4.8GHz | 32GB RAM | EVGA RTX 3080Ti | Maximus Hero VII | 512GB 860 Pro | 512GB 850 Pro | 256GB 840 Pro | 2TB 860 QVO | 1TB 870 EVO | Seagate 3TB Cloud | EVGA 1000 GQ | Win10 Pro | EK Custom water cooling.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...