Elvas Tower: Shadow map fixes are causing problems - Elvas Tower

Jump to content

  • 2 Pages +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

Shadow map fixes are causing problems Rate Topic: -----

#1 User is offline   Eldorado.Railroad 

  • Foreman Of Engines
  • Group: Status: Contributing Member
  • Posts: 984
  • Joined: 31-May 10
  • Gender:Male
  • Country:

Posted 16 February 2014 - 09:10 PM

Way.....back in x1587 this is the way dynamic shadow maps looked like:
Attached Image: x1587.gif
Note the nice saturation of the tree in the foreground.

Later...in x1674 (and any version since), black triangles (circled in red) began to appear at viewing certain angles:
Attached Image: x1674Left.gif
Attached Image: x1674Right.gif
Note how the tree shadow is now more "watered down" at the base from where it was in x1587.

A look at the SVN log gives the two possible changes that occured to dynamic shadows:
1600 Mon May 06 17:46:22 EDT 2013 twpol Bug 1098600 - fix for shadows being quite faint.
1597 Mon May 06 07:28:09 EDT 2013 twpol Bug 1098600 - fix for shadow inclusion test and shadow map center calculation.


I have spent quite a few hours with ShadowMap.fx and SceneryShader.fx and I have not been able to eradicate the black triangles. These are only caused when the user sets:
ShadowMapCount = (user set) 2 (or more)

For illustration purposes (and personal preference):
ShadowMapDistance = (user set) 450

Note that changes were made to both of these files in x1597 as per the SVN log:
/trunk/Source/RunActivity/Viewer3D/RenderFrame.cs
/trunk/Source/RunActivity/Processes/RenderProcess.cs


Testing CSM in a valley route emphasizes the problem of the black triangles. You will have to hunt right and left in any camera view to see them, but once in view they do not move their position until the "sun" moves. AFAIK they are visible at some angle throughout the "simulator day" but note that the screen captures are at about 12:00pm. Note the direction and position of the black triangles relative to all the other "wanted" shadows.

Even the most recent versions of OR have these artifacts. Thanks for "unXNBing" the .fx files as it is for easier to take a good look at their contents and have the JIT compiler do its magic at runtime.

Is there a way to revert back to the "old" way of generating shadows?

Many thanks.

#2 User is offline   James Ross 

  • Open Rails Developer
  • Group: Status: Elite Member
  • Posts: 5,492
  • Joined: 30-June 10
  • Gender:Not Telling
  • Simulator:Open Rails
  • Country:

Posted 17 February 2014 - 02:06 AM

View PostEldorado.Railroad, on 16 February 2014 - 09:10 PM, said:

Is there a way to revert back to the "old" way of generating shadows?


No. Either identify the problem, so we can fix it, or wait for someone else to do so.

I've seen the black around the edges too, and it's not being ignored, but shadows are a complex system of projections and culling.

#3 User is offline   captain_bazza 

  • Chairman, Board of Directors
  • PipPipPipPipPipPipPipPipPipPipPip
  • Group: ET Admin
  • Posts: 13,928
  • Joined: 21-February 06
  • Gender:Male
  • Location:Way, way, way, South
  • Simulator:MSTS & OR
  • Country:

Posted 17 February 2014 - 03:36 AM

I concur with Steve re the shadow 'edge artifacts, Unfortunately I cannot pin them back to the originating version, but they have existed for many versions back. My videocard is an Nvidia. Steve has put in many hours of hard yacca researching this 'bug' and I'm certain his effort is greatly appreciated by those of us who don't have the teccy expertise to delve into the murky bowels of OR's code.

Cheers Bazza.

#4 User is offline   dennisat 

  • Conductor
  • Group: Status: Contributing Member
  • Posts: 474
  • Joined: 16-February 13
  • Gender:Male
  • Simulator:Open Rails & MSTS
  • Country:

Posted 17 February 2014 - 04:44 AM

View PostEldorado.Railroad, on 16 February 2014 - 09:10 PM, said:

... I have not been able to eradicate the black triangles. These are only caused when the user sets:
ShadowMapCount = (user set) 2 (or more)
...


I found very early on with OR (when V0.9 was first released?) that I got very weird effects with the default shadow settings. For instance, hard lines across the scene, areas of light and not so light (not really shade) flicking back and forth.
After some experiment I settled on the following which with my limited range of routes still gives very acceptable results:

ShadowAllShapes = (user set) True
ShadowMapBlur = (user set) False
ShadowMapCount = (user set) 1
ShadowMapDistance = 1000
ShadowMapResolution = (user set) 6144

My graphics card is an Nvidia GTX640 with 1GB of memory, which is fairly modest by today's standards.
I went to X2021 recently and didn't like the effects Textures Flickering/Shimmering so I reverted to X2012. I will find the time to try something from X2022 onwards in the near future, I hope.

Dennis

#5 User is offline   James Ross 

  • Open Rails Developer
  • Group: Status: Elite Member
  • Posts: 5,492
  • Joined: 30-June 10
  • Gender:Not Telling
  • Simulator:Open Rails
  • Country:

Posted 17 February 2014 - 05:20 AM

View PostEldorado.Railroad, on 16 February 2014 - 09:10 PM, said:

I have spent quite a few hours with ShadowMap.fx and SceneryShader.fx and I have not been able to eradicate the black triangles. These are only caused when the user sets:
ShadowMapCount = (user set) 2 (or more)


The black marks at the edge are where two levels of the cascade meet. That's why you won't see them when you use just 1 shadow map level.

  • Either, the projection test in the shader is wrong, so the ground is using the wrong shadow map level.
  • Or, the shadow map culling is wrong, so there are elements missing from that shadow map level.


I think the former is more likely, with the current code, but it'll take time to figure out. If you want to help diagnose the issue, please use the current code or you may find fixes are no longer relevant/apply to the code.

#6 User is offline   Eldorado.Railroad 

  • Foreman Of Engines
  • Group: Status: Contributing Member
  • Posts: 984
  • Joined: 31-May 10
  • Gender:Male
  • Country:

Posted 17 February 2014 - 08:35 PM

View PostFrom 17 February 2014 - 05:20 AM:

If you want to help diagnose the issue, please use the current code or you may find fixes are no longer relevant/apply to the code.


Are you referring only to "changes" in the .fx files here? These are the only files I have been looking at and modifying.

Thanks.

#7 User is offline   James Ross 

  • Open Rails Developer
  • Group: Status: Elite Member
  • Posts: 5,492
  • Joined: 30-June 10
  • Gender:Not Telling
  • Simulator:Open Rails
  • Country:

Posted 18 February 2014 - 12:43 AM

View PostEldorado.Railroad, on 17 February 2014 - 08:35 PM, said:

Are you referring only to "changes" in the .fx files here? These are the only files I have been looking at and modifying.


I could not tell from your original post what you had been modifying nor what versions you had used when doing so. The version numbers you did mention were old and I want to make sure that any modifications you make to fix issues is done with the latest code - otherwise there is a risk it'll be unusable.

#8 User is offline   Eldorado.Railroad 

  • Foreman Of Engines
  • Group: Status: Contributing Member
  • Posts: 984
  • Joined: 31-May 10
  • Gender:Male
  • Country:

Posted 19 February 2014 - 07:36 AM

View PostFrom 18 February 2014 - 12:43 AM:

I could not tell from your original post what you had been modifying nor what versions you had used when doing so.


From the screen captures references in the O/P I looked at x1587, x1674 which I labeled. I looked at a whole bunch of compiled eXperimentals that your personal website provides (very smart and very helpful, thanks James). What is getting in the way is that there are no static snapshots of source code to look at and unfortunately time was an issue to do so with SVN some months back. I have been examaning and modifying more recent version of .fx (latest is x2027...I think), sorry if the term "recent" was not explicit enough in the O/P.

It would be very helpful to have source code snapshots just prior to x1597 and right after x1600. I spent several hours last night looking at the annotations for several source files on SVN and unfortunately some changes that were indicated in several .cs for x1597 have now vanished. Nobody is pretending that the solution is to revert back to just prior x1597 but what can be observed is that the triangles in the FOV were not there, and the shadows were more saturated in x1587. Whatever fixes in x1597 and x1687 to resolve bugs seem to make the results "less desirable" afterwards. I have taken the time to go through a great many compiled code snapshots on your website and ALL have the same problem. The release from .XNB occurred somewhere late in the x1500 series of compiled releases which makes looking at the .fx files from that time..."difficult".

Would you have any relevant code snapshots to look on your HD that I could use to track down the source of the shadow map artifacts?

#9 User is offline   James Ross 

  • Open Rails Developer
  • Group: Status: Elite Member
  • Posts: 5,492
  • Joined: 30-June 10
  • Gender:Not Telling
  • Simulator:Open Rails
  • Country:

Posted 19 February 2014 - 08:18 AM

View PostEldorado.Railroad, on 19 February 2014 - 07:36 AM, said:

Would you have any relevant code snapshots to look on your HD that I could use to track down the source of the shadow map artifacts?


Subversion has all the history and is publically accessible; there is no need for code snapshots at all.

But I think you've misunderstood the problem here. We have added significant new features, such as cascaded shadow maps, which have many benefits but also currently this black triangle bug. What you appear to be suggesting is that we remove the entire feature. You're welcome to help fix the black triangle bug but simply reverting the entire change that added it (that added the whole new feature) isn't going to be accepted.

#10 User is offline   Eldorado.Railroad 

  • Foreman Of Engines
  • Group: Status: Contributing Member
  • Posts: 984
  • Joined: 31-May 10
  • Gender:Male
  • Country:

Posted 19 February 2014 - 05:22 PM

View PostFrom 19 February 2014 - 08:18 AM:

James Ross wrote:
Subversion has all the history and is publically accessible; there is no need for code snapshots at all.


Yes, that is exactly what I have been accessing on the SVN server. However, I have not had success in backdating/reverting to a specific eXperimental version of OR, lock, stock, and barrel. This would help me do comparisons in both results and the code, which would help solve problems.

View PostFrom 19 February 2014 - 08:18 AM:

James Ross wrote:
But I think you've misunderstood the problem here. We have added significant new features, such as cascaded shadow maps, which have many benefits but also currently this black triangle bug. What you appear to be suggesting is that we remove the entire feature.


AFAIK, and could observe, we have had CSM for a very long time, why else would we have the capability of using 4 shadow maps? So it has been around for several years in OR. I am not suggesting that we remove the entire feature, hardly. Why would you assume that? What I am suggesting is that with the versions discussed in the O/P that something has been added in the fixes, namely the triangles, but also weaker shadows. On this side of the screen CSM seemed to be just fine before the fixes, I never had any problems with it, perhaps a few compromises. That is why being able to compare both code sets, side by side, would be helpful. As mentioned in the previous paragraph, in my SVN tool I can see what was added in what version of the code, but I cannot see what the code looked like before the changes were made (this means that a certain eXperimental version is "compilable" even at this this late date for comparisons). The solution to the problems might be a hybrid between both CSM systems, the old one and the new one with the problems.

I hope that this is clear now what the intent is. Just trying to help/fix and not just excise.

Thanks.

  • 2 Pages +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users