Shadow Fix

General discussion about Train Simulator, your thoughts, questions, news and views!

Moderator: Moderators

wacampbell
Been on the forums for a while
Posts: 174
Joined: Tue May 14, 2002 12:00 am
Location: Wayne Campbell, BC, Canada

Shadow Fix

Post by wacampbell »

Here's a little graphics improvement for TS2016. Its a very unofficial replacement for the sunlight shader provided in the Railworks\dev\Shaders folder. Here's what it does:

1. Fixes a shadow bias problem that was causing light to leak through overhanging eves when you pull back a certain distance from the building:
Image


2. Enables blending on cascaded shadow maps to prevent sharp cutoffs of shadows at distance:
Image


3. Enables screen-space ambient occlusion to improve the looks of models on their shadowed side:
Image

See the readme for installation instructions. Its just one file to copy into your shaders folder.

Also, this worked OK for me, but these features must have been disabled for a reason. So your mileage may vary. Be prepared to revert back to the original shader if things don't look right.


Wayne

Download here http://www3.telus.net/wacampbell/downlo ... dowFix.zip
deltic009
Very Active Forum Member
Posts: 4017
Joined: Fri Nov 27, 2009 1:06 am

Re: Shadow Fix

Post by deltic009 »

Very interesting, both the shadow and particularly the AObseem very good.
Matthew Wilson, development team at Vulcan Productions

http://www.vulcanproductions.co.uk
https://www.facebook.com/VulcanFoundry/
bremen
Been on the forums for a while
Posts: 213
Joined: Sat Nov 05, 2005 3:43 pm
Location: Milan - Italy
Contact:

Re: Shadow Fix

Post by bremen »

I tried it and the results are awesome. :D :D
Wacampbell, you have done a really wonderful modification. 8)

My FO HGe 4/4 before your fix.
Image

After it. :o
Image
wacampbell
Been on the forums for a while
Posts: 174
Joined: Tue May 14, 2002 12:00 am
Location: Wayne Campbell, BC, Canada

Re: Shadow Fix

Post by wacampbell »

Its good to see its working for you. I have had some reports that it doesn't well work for everyone. It must be hardware dependent.

For reference, I am running a GTX970, Driver Version 10.18.13.6869 on Windows 10. 4K Resolution - 3840 x 2160

Good luck with it!
User avatar
TrabantDeLuxe
Been on the forums for a while
Posts: 190
Joined: Fri Feb 20, 2015 6:10 pm

Re: Shadow Fix

Post by TrabantDeLuxe »

Hi Wayne,

First of all, impressive work. I never knew that we where able to compile our own shaders. Would it be possible for you to do a bit of a write up of the changes?

I've tried your patch, and probably due to my low shadow settings (I'm running a Core2Potate E6600, 6GB ram and a GTX275, so anything else kills FPS...), and the result sadly is the dreaded banded shading. I suppose this is not a bug.

Image
deltic009
Very Active Forum Member
Posts: 4017
Joined: Fri Nov 27, 2009 1:06 am

Re: Shadow Fix

Post by deltic009 »

bremen wrote:I tried it and the results are awesome. :D :D
Wacampbell, you have done a really wonderful modification. 8)

My FO HGe 4/4 before your fix.
Image

After it. :o
Image
Wow, would I be correct in saying your models textures don't currently have the ambient occlusion used within them? The difference between to two shots is amazing because of the difference represented, it's as if you no longer need to worry about baking AO maps to bake textures off anymore.

I cant wait to try this out.
Matthew Wilson, development team at Vulcan Productions

http://www.vulcanproductions.co.uk
https://www.facebook.com/VulcanFoundry/
User avatar
TrabantDeLuxe
Been on the forums for a while
Posts: 190
Joined: Fri Feb 20, 2015 6:10 pm

Re: Shadow Fix

Post by TrabantDeLuxe »

I'd always bake AO. Preferably from high poly, so you can have much more detail than just flat colour. To be fair, the example above looks impressive.
deltic009
Very Active Forum Member
Posts: 4017
Joined: Fri Nov 27, 2009 1:06 am

Re: Shadow Fix

Post by deltic009 »

It may well be a graphics settings thing for the nVidia control panel, but I noticed very little change to the shading of the shadowy side, perhaps because it was dark, but I did notice the shadow banding mentioned by TrabantDeluxe. Below is a comparios, click for full size for like for like 100% crops of larger screenshots
Shader comparison.jpg
Matthew Wilson, development team at Vulcan Productions

http://www.vulcanproductions.co.uk
https://www.facebook.com/VulcanFoundry/
bremen
Been on the forums for a while
Posts: 213
Joined: Sat Nov 05, 2005 3:43 pm
Location: Milan - Italy
Contact:

Re: Shadow Fix

Post by bremen »

TrabantDeLuxe wrote:Hi Wayne,

First of all, impressive work. I never knew that we where able to compile our own shaders. Would it be possible for you to do a bit of a write up of the changes?

I've tried your patch, and probably due to my low shadow settings (I'm running a Core2Potate E6600, 6GB ram and a GTX275, so anything else kills FPS...), and the result sadly is the dreaded banded shading. I suppose this is not a bug.
Unfortunately i have to report the same problem.
Yesterday night i was too impressed by the shadow side to look at the bright side. :(

Image

It affects the terrain too but only at a distance.
Image

My rig is composed by an AMD 8350 and an AMD Radeon 7970 gigahertz edition with 16.8.3 drivers. Full HD and win 7 64bit.

I have checked some of my 3Ds and the only objects unaffected by the black bands are the 3D sleepers placed as middle object in the loft blueprints.
I'll see if i can find some differences. :)
Wow, would I be correct in saying your models textures don't currently have the ambient occlusion used within them? The difference between to two shots is amazing because of the difference represented, it's as if you no longer need to worry about baking AO maps to bake textures off anymore.
I'm using 3Dcanvas 7.12, which has no shadow backing option and, even thou i defined a custom shadow map for some of my 3Ds, i never achieved something as good as the SSAO of the modified shader.
User avatar
TrabantDeLuxe
Been on the forums for a while
Posts: 190
Joined: Fri Feb 20, 2015 6:10 pm

Re: Shadow Fix

Post by TrabantDeLuxe »

The SSAO aspect does interest me as well. I don't quite understand how it works, but still, interesting stuff. It would solve a lot of situation where you simply can't bake shadows on textures, such as where two assets intersect/meet. This deserves a lot of exposure imho.
wacampbell
Been on the forums for a while
Posts: 174
Joined: Tue May 14, 2002 12:00 am
Location: Wayne Campbell, BC, Canada

Re: Shadow Fix

Post by wacampbell »

Its too bad about the banding. I don't see it on my pc, but certainly others are. I think the banding comes from the shadow bias adjustments and is not caused by the AO. I wonder if it would have value for me to release just the A O part of the fix?
User avatar
TrabantDeLuxe
Been on the forums for a while
Posts: 190
Joined: Fri Feb 20, 2015 6:10 pm

Re: Shadow Fix

Post by TrabantDeLuxe »

Don't worry, I know there's not much you can do about the banding. I'd love to see the SSAO only bit, and I'm sure others will too.
User avatar
JamesLit
Been on the forums for a while
Posts: 111
Joined: Sun Jan 06, 2013 2:46 am
Location: Kent, UK
Contact:

Re: Shadow Fix

Post by JamesLit »

The SSAO would be great to see on its own. I'll have a look myself, and see if I have the shadow banding, too.
All the best,
James

The Forge Simulation | Like us on Facebook!
Owner & Director | Content built with care, not compromises.
bremen
Been on the forums for a while
Posts: 213
Joined: Sat Nov 05, 2005 3:43 pm
Location: Milan - Italy
Contact:

Re: Shadow Fix

Post by bremen »

wacampbell wrote:Its too bad about the banding. I don't see it on my pc, but certainly others are. I think the banding comes from the shadow bias adjustments and is not caused by the AO. I wonder if it would have value for me to release just the A O part of the fix?
Yes it has value alone. :D

The SSAO is a base feature in most modern games.
wacampbell
Been on the forums for a while
Posts: 174
Joined: Tue May 14, 2002 12:00 am
Location: Wayne Campbell, BC, Canada

Re: Shadow Fix

Post by wacampbell »

For those who are experiencing the banding problem described above,here is a version of the shader that enables SSAO, but reverts out the shadow bias and cascade blending fixes.

http://www3.telus.net/wacampbell/downlo ... ksSSAO.zip



Wayne
Locked

Return to “[TS] General Discussion”