New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shadows #1547
Shadows #1547
Conversation
…using per-pixel lighting.
…-line functions that are only ever called in one location.
@terabyte25 we're still in 0.46 development... asap / time is relative :) |
Guys, I think all the ticks are ticked! |
So any objections left, or we can merge this PR at last? |
@akortunov this patch for mesa users is not merged yet, @AnyOldName3 said it would be (it seems he just forgot?). |
Yeah, I should merge that... |
I merged that. |
Last call... |
Did the shadow map resolution stuff breaking due to insane resolutions thing get fixed? Does it even count as a blocker to this PR? |
IIRC, we consider it as a "not an issue". |
Any progress here? I see no blockers in the PR description. |
AnyOldName3 is stuck trying to debug some OpenGL errorrs that appear when looking at the sky under Mesa and not Nvidia. |
It actually seems to not happen under Mesa, either, just AMD's proprietary Windows driver. It's been a nightmare to debug, as it won't happen when an OpenGL debugger is attached, and while it does trigger khr_debug messages, all OpenGL state gets reported as default, which can't be the case as otherwise there'd be no error. The next step is to build OpenMW against a build of OSG with debug symbols, as at least then I'll be able to see what OSG thinks is going on. The issue with that is that OSG and OpenMW don't like linking on Windows, so I'm at the mercy of ananace. He finished the OSG build on Friday night, but I didn't have any time yesterday to look at it. |
@AnyOldName3 do you consider this a blocker? Would merging this in and getting it to the masses have any value in helping to resolve this issue? We could put out a call for feeback when people use amd gpu drivers for windows. |
The hard part is being able to reproduce it in the first place when it's vendor-specific, and I can do that. More testers wouldn't help. At least in the short term, I'm going to consider it a blocker. An OpenGL error shouldn't happen unless someone's made a mistake, so it's not impossible that there are other symptoms that just haven't been found yet. If I still can't fix it when I have everything set up with debug symbols, I might demote it to non-blocker and merge anyway. |
That should be all the blockers dealt with now. |
Still in [Review time] or good to merge? |
Hellllll yesss |
Finally. I should probably post it on r/Morrowind. |
I would be hesitant of advertising this too much until the actual release that includes it is out. Otherwise we get a bunch of people asking why they can’t see the option. Also in our news post we should make it obvious how to enable. But hooray! They’re merged! |
I could write another post on how to enable them tomorrow I guess... |
@lysol90 is it possible for you to add that on to the current one? |
Something like that is probably best achieved by adding two planes to some part of the body mesh and making them not have vertex weights so they stay stuck to the floor. It's probably less work to do it like that, and it definitely leaves the engine in a more maintainable state. The way you've drawn it, though, makes it look a lot like (very localised) SSAO, and we'll have support for some form of that when we implement post-process shaders. It'll have a much smaller performance hit than proper shadows, but will be able to apply an effect like in your screenshot everywhere, not just to feet. |
Thanks for the reply AnyOldName3! Can you think of a way whereby the opacity of shadow texture could be reduced when the foot lifts off the ground? Perhaps the size of shadow could increase also with foot height. Are any modders reading this who could add shadow textures to feet? |
There's probably some Nif property you can make vary over the course of the animation cycle. |
Scrawl suggested I actually make a PR for this so that it's easier to keep track of while the last few things are sorted out.
Current issues (that I can think of):
Blockers
I've not decided which way to make the sky not receive shadows is best (https://github.com/AnyOldName3/openmw/tree/osgshadow-test-vdsm-sky-method-one versus https://github.com/AnyOldName3/openmw/tree/osgshadow-test-vdsm-sky-method-two)Scrawl likes method two and I trust his judgement above my own.potentially somehow warn users that they might get issues with shaders off unlessforce shaders on, but maybe the documentation should suggest they want to do thisshadermanager.cpp
MWShadow
into two classes - a shadow technique class based directly onosgShadow::ViewDependentShadowMap
and a shadow manager class handling interaction with the rest of the engine.Work out why some Linux users are seeing issues that I'm not, and fix the problem.(This wasn't Linux-specific after all, and was just that distant land was on and broke things.)similar light and camera anglesthat wasn't the issue shadow maps being set up to cover non-existent objects under the ground.reappearednever actually been solved?ComputeLightSpaceBounds
visitor (which I'm not 100% sure is ever doing its job properly or we'd not have issues when increasing view distance but leaving distant terrain off... unless it's the same water-has-a-huge-bounding-sphere issue that means we can't do bounding volume based traversals).RenderLeafTraverser<RenderLeafBounds>
.Work out what's going on with this screenshot. The nearest shadow map (red) is excessively distorted, removing detail from the tree on the left.I didn't work out what was going wrong, but I fixed this by accident.OSG 3.6maybe not OSG 3.6@akortunov's mad computer which has issues no one else has reported.Not just akortunov's computerabsolutely ridiculous viewing distances.Fixed the viewing distance issueyet another reason.the CLSB visitor giving erroneous results & the ConvexHull thing not considering shadow casters outside of the viewing frustum.Investigate issue 1 in this post: Shadows #1547 (comment)Solve issue where OSG's computed far plane is nearer than the most distant geometry.The computed far plane was fine all along. Solve distant (relatively speaking) shadows disappearing due to erroneous clipping.Work out if there's a reason @akortunov had minimap and character preview issues after I fixed them for other people and if the magic fix that shouldn't have worked with CSM is reliable and identifiable.No one else has reported anything, so hopefully this is fine.Investigate and fix this unholy abomination: Shadows #1547 (comment)The person who reported this can no logner replicate it, so I'm going to assume I've fixed it by fixing something else.The root cause is all shadow maps sharing the same near/far planes so the near shadow map has basically no depth resolution.The actual root cause is that the terrain paging system regards all shadow cameras as maximally distant, so serves up the same single whole-of-MorrowindThe real actual cause was that the shadow map near plane was too far from the things receiving shadows. Using depth clamping to move it closer without preventing things outside the viewing frustum casting shadows has sorted this out.TerrainDrawable
for each of them, and that forces all shadow maps to use the same near/far planes so the near shadow map has basically no depth resolution. This issue can be avoided by disabling terrain shadows, which are basically garbage anyway and will be until the issue is resolved. Attempts to do so have lead to weird crashes, so this is being backburnered for now.suggests this is another LiSPSM issue.shows this is myConvexHull::extendTowardsNegativeZ()
function failing in common edge cases and the providedConvexHull::clip(osg::Plane)
function failing in edge cases made common by theextendTowardsNegativeZ
function's introduction.TerrainDrawable
, which is far too low quality to let all but the largest mountains cast any shadows.colorMode
issue (erroneously described as full object shadow pop-ins here: Shadows #1547 (comment))Non-blockers
allow shadow map overlap
is enabled so performance doesn't fall linearly as more shadow maps are added.ComputeLightSpaceBounds
visitor.distant statics shadows
setting.RenderLeafTraverser<RenderLeafBounds>
.minimum lispsm near far ratio
setting which doesn't produce artefacts. Users can help with this, and may find playing with the values at the bottom ofshadow.hpp
in this branch useful. Remember that before telling me that a value is safe, it needs to work (meaning not look worse than a lower value) both with and without the CLSB applied (the thing that automatically toggles), with and without a high view distance, with and without distant terrain, with and without split shadow maps (look at the end bit of the terrain fragment shader if not using exactly three), in first and third-person view, and in various combinations of these settings. MOVED FROM BLOCKERS TO NON-BLOCKERSMaybe unrelated to shadows
Want to tell me how well this works on your machine? I'll need screenshots (ideally with the debug hud turned on), a description of your shadow settings and maybe a
coc
target and definitely to know whether distant terrain is on.Testing both with and without this patch (including with and without shadows enabled) on a range of systems might be helpful to me. I know it makes a difference on Mesa, and no difference with AMD's and Nvidia's proprietary Windows drivers, but don't know for other situations.
Want to give me free money because you really like shadows? I have a Patreon at https://www.patreon.com/AnyOldName3