Best Quality Shadows And Errors In Default Configuration

Discussion in 'TSW General Discussion' started by geloxo, Jan 2, 2022.

  1. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,694
    I found some settings which allow a much better shadow displaying. Unfortunatelly there are also some errors in the shadows system.

    The first block deals with resolutions and transitions. The default configuration is basically not producing any shadows as most of the features only produce effects when really close to the objects. The following settings allow to increase the resolution and viewdistance of those shadows:

    r.Shadow.MaxResolution=4096
    r.Shadow.MaxCSMResolution=4096
    r.Shadow.DistanceScale=2
    r.Shadow.TransitionScale=2
    r.Shadow.CSM.TransitionScale=2
    r.Shadow.CSMDepthBias=8 <-- optional setting
    r.Shadow.CSMShadowDistanceFadeoutMultiplier=0.1
    r.Shadow.RadiusThreshold=0.005

    The following additional settings can be also used:
    • r.Shadow.FilterMethod=1 (uses Nvidia's PCSS shadow technology, which makes shadows diffuse and get softer the further they are from the source object. Default is 0)
    • r.LightMaxDrawDistanceScale=10 (allows to increase locomotive headlights draw distance. This also affects street lamps and other light sources in buildings. Values above 10 do not increase the locomotive headlights any further. Default is 1)
    In the examples below you can see how a much bigger amount of shadows is applied to situations where normally are not applied by default configuration, producing a darker and more detailed environment:

    00.jpg

    01.jpg

    02.jpg

    Close view and detail of the terrain shadows on a trench:

    05.jpg

    Now some comments:

    - Unfortunatelly the overall shadow draw distance still limits the ambient occlusion on distant terrain and objects, and produces the "reality bubble effect" around camera position. This config does not solve it.

    - I didn´t find significant impact on performance but use those settings with care. Rising the quality too much may reduce performance on heavily populated areas on some computers. Also many values are limited by the overall shadow distance cap, so increasing their quality does not produce any effect but just increases the workload.

    - r.Shadow.CSMDepthBias is wrongly configured in default settings with a value of 10. It´s basically fading out most of the cascaded shadows 10 times earlier than they should and producing an overall excess of light in the whole scene. Normally this bias variable should be around 0 value as it defines the darkness of the shadow area around camera but that produces adverse results with the distance cap of shadows. I guess that this was a performance trick but it ruins the overall shadows system as many areas appear lit when they shouldn´t. However the shadows are still being computed by engine, so I don´t see the benefit in that. You can tune the darkness of the shadows by setting values lower than 10. Going too low increases the darkness area but also increases the reality bubble effect on open areas (short shadows drawdistance around camera). Something between 5 and 10 should be fine to get a bit darker shadowing area but due to this issue I just recomend this setting as optional and still with a high value. At the end of the following link you can find an explanation of how this variable should behave to define the starting point of the shadows. It´s for the mobile platforms case but I included as it comes with an interactive picture to see the different settings:

    https://docs.unrealengine.com/4.27/en-US/SharingAndReleasing/Mobile/Lighting/

    - Many trees and medium bushes are missing the shadows completely in the higher detail LODs. They appear totally lit when they shouldn´t. This seems to be an error in some of the 3D models and it happens in many of the routes with many different tree types. This should be reviewed by developers. In the example below you can see the case of West Cornwall. Distant trees are lit due to the shadow drawdistance limitation but the ones on the lower right side are broken. If you compare them with the ones on the lower left side you can notice that the side opposite to sun should be dark. They don´t cast any shadow while their high detail LODs are visible and only their lowest quality LOD has a rudimentary shadow which is never seen basically. I discovered that error while testing those settings.

    If you find in the routes some of those trees with LOD errors appearing lit please report them to helpdesk so that they can be fixed, as the error is also reproduced when using the default settings but is hidden by the lack of shadows intensity and quality caused by default configuration itself.

    04.jpg

    Cheers
     
    Last edited: Jan 7, 2022
    • Like Like x 11
    • Helpful Helpful x 7
  2. Cael

    Cael Well-Known Member

    Joined:
    Jul 26, 2018
    Messages:
    667
    Likes Received:
    1,366
    Interesting. Can you try with some more populated areas and see if you notice a performance drop?
     
  3. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,694
    I didn´t find issues with that so far. The heighfield shadows may be the ones bringing additional workload because they were disabled but as the terrain mesh we have is not ultradetailed this didn´t hurt so much. Maybe 5 fps or so in some cases but this depend on each system capabilities.

    Cheers
     
  4. Dinosbacsi

    Dinosbacsi Well-Known Member

    Joined:
    Sep 20, 2017
    Messages:
    3,312
    Likes Received:
    8,665
    Nice. I have a fairly low end GPU (1050Ti), will try these out and see what happens. Such a shame we still can't get rid of the low shadow draw distance, or the "reality bubble" as you've said. In hilly routes it's so painfully obvious and ugly, like Arosalinie. Those routes could have much better visuals with just lighting tunes, probably.
     
  5. robski

    robski Member

    Joined:
    Jul 11, 2019
    Messages:
    72
    Likes Received:
    89
    Nice settings they look absolutely beautiful.. Sad thing is I went from 60 fps to 30 fps on Riesa Dresden :(
    I have RTX 2070 Super and 8700 K.
     
  6. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,694
    Riesa has something hidden in the tiles that has impact on performance and it´s not related to shadows as I get continuous microfreezes in the middle of almost empty areas just when the very far part of scenery is processed. However I get fluent 85 fps driving on LGV or Aachen on highly populated forests and no such issues with far scenery. I think that the problem are some of the persistent objects which are visible at much higher distance than the rest (platforms, relevant factory assets or buildings, forests, etc) having a crazy LOD configuration. If you set r.ViewDistanceScale=0 for a quick test just with such few a patetic amount of objects and details on the screen the game still hangs on the tile loading. This is an example of what is left in the screen in the case of Aachen (some sparse buildings that anyway shouldn´t be there, signals and some parked trains). However on some routes complete forest, cities or factories are still persistent on the lowest viewdistance setting. This means that they have at least a LOD setting independent from the rest of objects and therefore not controlled by that variable and they may the responsible ones of the performance hits at the end of the day. Even worse... There´s a hidden layer on some routes like Hamburg controlled by two more variables that contains entire parts of distant forests and buildings inside and which is not displayed in game. To display it and hide the rest set the first two variables to 1 and yet more persistent objects will appear.

    r.ViewDistanceScale.ApplySecondaryScale=1 (this activates the layer which is disabled in default config and shall stay disabled)
    r.ViewDistanceScale.SecondaryScale=1 (this controls the view distance for that extra layer)
    r.ViewDistanceScale=0 (this hides the rest of the standard objects and leaves the persistent ones only)

    Do not use those variables for regular playing as who knows what the impact on performance would be. Just use it for test purposes if you are curious about it.

    test.jpg

    Anyway try to avoid using r.viewdistancescale higher than 3. It kills performance and also shadows are affected by that, as more distant objects become rendered with high details. Another performance hit comes when using foliage.LODDistanceScale higher than 5 or any other tweak that forces high detail LODs on trees, as their detailed shadows become active as well. Avoid by all means using foliage.ForceLOD=0 as this would render detailed trees and their shadows even on far trees. This basically disables the LODs on trees and as we usually have quite a lot of them this has a massive performance hit even on high end systems.

    Cheers
     
    Last edited: Jan 2, 2022
    • Helpful Helpful x 2
  7. Dinosbacsi

    Dinosbacsi Well-Known Member

    Joined:
    Sep 20, 2017
    Messages:
    3,312
    Likes Received:
    8,665
    Man, they really need to sort their LOD issues out. You will have massive factory buildings popping in from a visible distance even on high setting, then have totally irrevelant buildings stay on even with literally nothing else rendering. Then there are things like trees changin color with different LODs, or the grass issues on Sherman Hill. There is a big incosistency in asset quality and it shows, they should really find the problematic assets and fix them.

    Edit:
    A great example of what just has been said about asset quality, something I just noticed on Arosalinie 10 minutes ago. Some tree types simply have no shadows at all!
    [​IMG]
    No wonder the route can look very unnatural, when even trees 10 meters away from a track don't have such basic things like shadows.
     
    Last edited: Jan 2, 2022
    • Like Like x 6
  8. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,694
    Yeap. Those unbalanced objects qualities are a problem. If they have not properly set the LODs of the objects as well that´s one of the possible reasons for those bizarre performances on some routes. Look what is hidden in Riesa route on the secondary viewdistance layer that I explained before. When you set viedistance 0 to hide the main map and make the secondary viedistance layer active half of the original route appears duplicated... And you can´t get rid of those objects as trying to change r.ViewDistanceScale.SecondaryScale has no effect on their viedistance at all. Something is wrong there I´m afraid.

    riesa.jpg

    The problem is that game in handling the two layers in terms of computing, as disabling viewdistances or reducing them does not increase the FPS at all. So basically game is still rendering under the hood the shadows, the LODs, etc of those collections of objects which are not visible. You can easily lose 20fps due to that joke. This may explain why some routes like Aachen perform well while Riesa performs so bad on all computers, no matter which settings anyone uses.

    On the other hand increasing the viewdistances does not have significant performance hit either when being inside a tile. FPS are basically the same and the only thing that changes is the amount of objects to process when we switch from one tile to the next one, that is what produces the tile loading lag. If this is true this would mean we have a serious issue with the scalability settings in game. It has no sense that in a map with 0 or 10% of viewdistance you still have the same ugly performance when nothing is being rendered as in the case of a 400% viewdistance when basically all in rendered miles ahead of you. In the previous UE version reducing or increasing r.viewdistance had big effects on performance.

    If someone has Sherman Hill and can repeat this test and we see another hidden layer populated with tons of trees there this would explain why seting a x1.5 scale on foliage already kills performance on that route when in others has almost no effect. Just past this at the end of your existing engine.ini file to perform the test and remove it after that:

    r.ViewDistanceScale=0
    r.ViewDistanceScale.ApplySecondaryScale=1
    r.ViewDistanceScale.SecondaryScale=1

    I have sent a ticket to helpdesk. Without any doubts both topics need a check.

    Cheers
     
    Last edited: Jan 3, 2022
    • Like Like x 3
  9. Dinosbacsi

    Dinosbacsi Well-Known Member

    Joined:
    Sep 20, 2017
    Messages:
    3,312
    Likes Received:
    8,665
    I tried these settings but my routes were full of scenery anyway. How did you manage to make them disappear?
     
  10. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,694
    I just put that in the console commands or in the engine.ini. Be sure that r.viewdistancescale is not repeated elsewhere in your file. If you place that at the end of the file its better as nothing will override it. I just tested yesterday with LGV, Aachen and Munich and it empties the routes.

    Cheers
     
  11. Dinosbacsi

    Dinosbacsi Well-Known Member

    Joined:
    Sep 20, 2017
    Messages:
    3,312
    Likes Received:
    8,665
    Alright, my bad. I was using the TS2Prototype folder and not TrainSimWorld2 folder.

    So I can confirm, Sherman Hill does have quite a bit of scenery even with these setting. For example, in Cheyenne most of the city is still visible, so are all these scenery car models and all of these light poles. Foilage seems to be working correctly, most of the grass and shrubs only spawn in when I'm right on top of them.
    [​IMG] [​IMG]
    [​IMG]

    At one point I fell through the floor and all of these suburban house blocks were still visible as well. They are big "street blocks" with houses and trees on them.
    [​IMG]
    [​IMG]
    Interestingly enough, my framerate didn't go above 45 when looking at Cheyenne even with these settings, which is quite shocking. Are these buildings, cars and poles eat up framerate just by themselves?

    I also tried LIRR just out of curiosity. Mostly empty, but many city buildings are visible there as well. And surprisingly, all the PIS screens, lol.
    [​IMG]
     
  12. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,694
    That´s the point because I had exactly the same results on other routes. No matter which settings you use or if you are using x1 or x10 viewdistance. What defines the performance at the end of the day is that minimal amount of assets being left when removing the others. That has no sense anyway as a set of building cubes can´t eat 30 or 40 fps by themselves. This is bizarre but I sent a ticket to helpdesk just in case we have a resource hog here and we were not aware of it at all.

    Cheers
     
    Last edited: Jan 3, 2022
  13. Dinosbacsi

    Dinosbacsi Well-Known Member

    Joined:
    Sep 20, 2017
    Messages:
    3,312
    Likes Received:
    8,665
    It's a really interesting topic, that's for sure. Hopefully someone from the dev team sees it and the core team can make use of this information somehow, to improve the game performance.
     
    • Like Like x 1
  14. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,694
    Another bizarre bug. Camera asset itself also cast shadows on both terrain and objects or gets a shadow rectable attached to it somehow. This is randomly reproduced by means of a giant rectangular band that moves according to either player train or camera while in free camera view. The rectangle spawns on the outter limit of the shadows viewdistance (around 200-300m ahead of player). It happens just when a new tile is loaded and just randomly as well. I loaded a savegame that had the error active when in free camera view to try to check what´s going on there and then it didn´t reproduce.

    Sun position is just on top right of camera in the attached picture as soon as the band is appearing. Then the rectangle moves in accordance as soon as camera moves or rotates. It disappears some seconds afterwards (after position of sun changes). This game is amazing... :o:D

    camera.jpg

    Cheers
     
    Last edited: Jan 3, 2022
    • Like Like x 1
  15. solicitr

    solicitr Well-Known Member

    Joined:
    Jun 20, 2020
    Messages:
    11,735
    Likes Received:
    17,949
    Which if any of these shadow commands are framerate-neutral? I'm always happy to look for visual improvements, but my system can't take anything more that contributes to slowdown.
     
  16. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,694
    The resolution ones (the first two variables) are just an improvement by themselves alone. You can start there. Then add the scale variables (the next three in the list). The one with highest impact is r.Shadow.RadiusThreshold as the lower you go the more small elements shadows will render. The default value for it is 0.01. The default value for the scales is 1 and for the resolutions is 2048.

    You can also skip the resolution variables and just use the three scale variables. This will also work and will still produce nice shadows, but with lower resolution at 2048, which is more framerate friendly.

    If you are worried about performance skip the rest (the terrain heighfield and spotlights tweaks) as that´s optional.

    Cheers
     
    Last edited: Jan 3, 2022
  17. trainside

    trainside New Member

    Joined:
    Apr 15, 2021
    Messages:
    18
    Likes Received:
    16
    I have the same problem, I think it's these values that causes it

    r.HeightFieldShadowing=1
    r.AOHeightfieldOcclusion=1
    r.HFShadowQuality=3

    If I delete these values from Engine.ini the issue disappears.

    I found a thread on Unreal Engine forum, it might refer to the same problem
    https://forums.unrealengine.com/t/d...-light-shadows-dark-spots-on-terrain/140209/2

    Btw, thank you for your great guides to improve TSW2.
     
    Last edited: Jan 3, 2022
    • Like Like x 2
  18. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,694
    Thanks for feedback. Yes, it could be the ambient oclusion. Just don´t use those 3 variables if you are having that problem too frequently. They are really optional even if they enhance the overall scene. Remember that they are disabled in default config so maybe game is not using that feature at all even if it´s supported by engine. I will remove them from the first post just in case.

    Cheers
     
    Last edited: Jan 4, 2022
  19. Dinosbacsi

    Dinosbacsi Well-Known Member

    Joined:
    Sep 20, 2017
    Messages:
    3,312
    Likes Received:
    8,665
    What is HeightFieldShadowing supposed to do to begin with?
     
  20. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,694
    It allows terrain mesh to produce shadows as well. Currently other things like trees, building or trains already produce shadows and they cast them over the surronding terrain but the terrain itself is not producing any shadows. You can see the effect on the picture I posted about the trench. The trench left side (the green portion) produces shadow which is casted over the lower area (brown portion) of the terrain of the trench. Then also trees nearby produce their shadows as well.

    Cheers
     
    Last edited: Jan 3, 2022
  21. solicitr

    solicitr Well-Known Member

    Joined:
    Jun 20, 2020
    Messages:
    11,735
    Likes Received:
    17,949
    WOW!
    That, Mr. Geloxo, is a Magic Bullet command. Not only are the shadows far more realistic, but adding this has had the remarkable side-effects of (1) reducing the "creeping sleepers" effect, since it's caused by shadows and fading out the hard edges as they get farther from the camera makes it much less obvious, and (2) reducing flickering catenaries (since I can't go above 120 screen percentage), because much of that is caused by the system trying to antialias not the wires themselves but their backside shadows.

    And all without an apparent framerate penalty.
     
    • Like Like x 1
  22. crrispy

    crrispy Member

    Joined:
    Dec 25, 2019
    Messages:
    30
    Likes Received:
    12
    Hello,

    I'm currently fighting with an irritating behaviour in TSW 3 that I didn't really notice in 2: the shadows on rails/ballast in front of the loco which seem to be limited to something around 100m and advance with the train. This is particularly visible for example in the scenario "Route Solitaire" (in french) of Kassel-Wurzburg, the one with the single BR401 loco. I have tried these engine.ini settings but they don't solve the issue, just r.Shadow.FilterMethod=1 makes the transition in front of the train a bit smoother, but does not solve the problem. Is there any setting to change this and increase the shadow drawing distance in front of the train to something which would be far less noticeable?

    Edit: I removed r.Shadow.FilterMethod=1, it caused significant shadows issues, and had a severe impact on fps.

    Thanks.
     
    Last edited: Sep 13, 2022
  23. chieflongshin

    chieflongshin Well-Known Member

    Joined:
    Jan 4, 2019
    Messages:
    4,369
    Likes Received:
    7,214
    Has anyone noticed that in tsw3 you can pull into a station and sit there with a low res, low detail version? I've had it a few times where the station has not loaded until I was leaving. I don't know if this is only new or old routes, only seen on new so far
     
  24. bescot

    bescot Well-Known Member

    Joined:
    Dec 14, 2016
    Messages:
    624
    Likes Received:
    1,105
    How did I miss this thread? I had noticed that some 'new' looking trees in SEH2 looked terrible, flat and shadowless. I'm not sure which ini command did the trick from the first post, but by god it looks so much better. I'm getting no fps loss with a 3060ti either, Bravo geloxo
     
  25. tsw2

    tsw2 Well-Known Member

    Joined:
    May 31, 2022
    Messages:
    964
    Likes Received:
    1,934
    This seems like a lot of bizarre bugs...so the shadows are wrongly configured? The camera (player eyes) casts a big shadow?

    I hope DTG can comment on these and fix them. DTG JD can you please comment?
     
  26. Arpadiam

    Arpadiam Active Member

    Joined:
    Nov 4, 2020
    Messages:
    87
    Likes Received:
    142
    i think you nailed the issue that i'm experiencing and others players too
    tried cajon pass and the extension of SEH and i have the exact same issue, for some reason the game wont go above 45fps and i have pretty bad frametime ( framepacing )
    this is in the inital starting point of this service at 17:46 and you can see in the screenshot is terrible how bad is the frametime

    THIS IS WITH STOCK DEFAULT SETTINGS, the only turned off is Mblur and DoF
    [​IMG]

    and this is something that came with TSW3, becasue several of the routes that were working pefect on TSW2 now they are suffering this issue in TSW3, inconsisten frametime and stuttering

    i wasnt sure if was something related to simugraph or how UE4 handles ( and how is configured ) the LoD objects and the load and unload of assets

    lets see what DTG will do becasue at this point and knowing then i dont think they will do much, i hope i'm wrong
     
    Last edited: Sep 14, 2022
    • Like Like x 2
  27. atledreier

    atledreier Member

    Joined:
    Aug 23, 2022
    Messages:
    88
    Likes Received:
    34
    I wonder if the UE crash that many are getting is somehow connected to this?It points to someting being configured wrong anyway.
     
  28. crrispy

    crrispy Member

    Joined:
    Dec 25, 2019
    Messages:
    30
    Likes Received:
    12
    Here's a short video where the issue I mention is clearly visible. You can see the shadows on the track being drawn something like 100 meters ahead of the train. Very annoying, but it seems it can't be fixed, I've tried the whole ini parameters of the dx12 thread including the ones related to shadows, no change on this.

     
    • Like Like x 1
  29. chieflongshin

    chieflongshin Well-Known Member

    Joined:
    Jan 4, 2019
    Messages:
    4,369
    Likes Received:
    7,214
    I “think” but May wrong that was locked into the engine, it’s ironic as I think these were drawn longer on recent routes and may be another step backwards after improving it
     
  30. DTG JD

    DTG JD Director of Community Staff Member

    Joined:
    Feb 25, 2021
    Messages:
    2,889
    Likes Received:
    11,260
    I understand very little of this thread, but I've passed it on for those more in the know to review.
    Without knowing the ins and outs, difficult for me to say how easy it is to remedy.
     
    • Helpful Helpful x 1
  31. arek#2842

    arek#2842 Well-Known Member

    Joined:
    Mar 1, 2022
    Messages:
    479
    Likes Received:
    506
    I think it was always set up like this, at least it was the case for TSW2, the draw distance for tracks shadows. DTG has hardcoded it and it cannot be modified in any way.
     
  32. londonmidland

    londonmidland Well-Known Member

    Joined:
    Nov 8, 2017
    Messages:
    3,423
    Likes Received:
    18,140
    It begs the question as to why DTG has hard coded it and not allowed us PC users to modify it if we wish to do so?

    Speaking if which, has anyone noticed how bad trees look on SEHS? They tend to be so bright and unrealistically vivid looking, as well as having little to no shadows being casted on/by them. It looks like they’ve been modelled in MSPaint.
     
    • Like Like x 5
  33. tsw2

    tsw2 Well-Known Member

    Joined:
    May 31, 2022
    Messages:
    964
    Likes Received:
    1,934
    TSW is basically a house built on a terrible and unstable foundation. Sadly.
    And without a complete rework of the code base or a new engine this is most likely not going to change since DTG seems to be unable to fix it
     

Share This Page