{"action":"created","issue":{"url":"https://api.github.com/repos/OpenMW/openmw/issues/1547","repository_url":"https://api.github.com/repos/OpenMW/openmw","labels_url":"https://api.github.com/repos/OpenMW/openmw/issues/1547/labels{/name}","comments_url":"https://api.github.com/repos/OpenMW/openmw/issues/1547/comments","events_url":"https://api.github.com/repos/OpenMW/openmw/issues/1547/events","html_url":"https://github.com/OpenMW/openmw/pull/1547","id":272004223,"number":1547,"title":"[DON'T MERGE YET] Shadows","user":{"login":"AnyOldName3","id":8485112,"avatar_url":"https://avatars1.githubusercontent.com/u/8485112?v=4","gravatar_id":"","url":"https://api.github.com/users/AnyOldName3","html_url":"https://github.com/AnyOldName3","followers_url":"https://api.github.com/users/AnyOldName3/followers","following_url":"https://api.github.com/users/AnyOldName3/following{/other_user}","gists_url":"https://api.github.com/users/AnyOldName3/gists{/gist_id}","starred_url":"https://api.github.com/users/AnyOldName3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AnyOldName3/subscriptions","organizations_url":"https://api.github.com/users/AnyOldName3/orgs","repos_url":"https://api.github.com/users/AnyOldName3/repos","events_url":"https://api.github.com/users/AnyOldName3/events{/privacy}","received_events_url":"https://api.github.com/users/AnyOldName3/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":233,"created_at":"2017-11-07T22:16:18Z","updated_at":"2018-05-18T21:41:39Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/OpenMW/openmw/pulls/1547","html_url":"https://github.com/OpenMW/openmw/pull/1547","diff_url":"https://github.com/OpenMW/openmw/pull/1547.diff","patch_url":"https://github.com/OpenMW/openmw/pull/1547.patch"},"body":"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.\r\n\r\n# Current issues (that I can think of):\r\n\r\n## Blockers\r\n- [x] ~~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.\r\n- [x] The minimap needs shadows turning off.\r\n- [x] The character preview needs shadows turning off.\r\n- [x] Interiors need shadows to not be cast by walls etc. (as they use a 'fake' light source which is blocked everywhere)\r\n- [x] Settings need to be changeable by users instead of hardcoded.\r\n- [x] Description of settings needs adding to the documentation\r\n- [x] Turning on shadows should ~~potentially somehow warn users that they might get issues with shaders off unless~~ force shaders on, but maybe the documentation should suggest they want to [do this](https://github.com/OpenMW/openmw/pull/1547#issuecomment-369657381)\r\n- [x] Assorted parameter tuning to make things look as good as possible.\r\n- [x] Move as much as possible out of `shadermanager.cpp`\r\n- [x] Separate `MWShadow` into two classes - a shadow technique class based directly on `osgShadow::ViewDependentShadowMap` and a shadow manager class handling interaction with the rest of the engine.\r\n- [x] ~~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.)\r\n- [x] Ensure that shadow map projection keeps shadow map texels roughly 1:1 with screen pixels.\r\n* - [x] Fix this when due to perspective errors.\r\n* - [x] Fix this when due to a high viewing distance.\r\n* - [x] Fix this when due to ~~similar light and camera angles~~ *that wasn't the issue* shadow maps being set up to cover non-existent objects under the ground.\r\n   * - [x] Stop that fix from breaking first person meshes.\r\n   * - [x] Stop that fix from sometimes making shadows disappear from near to the camera when the closest thing to the camera is terrain, not an object.\r\n* - [ ] Fix this when due to similar light and camera angles as this issue seems to have ~~reappeared~~ never actually been solved?\r\n   * - [x] See how easily this can be fixed by messing around with Cascading Shadow Maps.\r\n   * - [ ] Implement a maintainable and configurable implementation of Cascading Shadow Maps.\r\n- [x] Ensure distant terrain causes no issues with the `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).\r\n- [ ] Sort out excessive light space perspective transformation effect with `RenderLeafTraverser<RenderLeafBounds>`.\r\n* - [ ] Stop distant terrain screwing up the ratio calculation.\r\n* - [ ] Work out what's going on with [this screenshot](https://i.imgur.com/I5nM3oC.png). The nearest shadow map (red) is excessively distorted, removing detail from the tree on the left.\r\n* - [ ] Suppress unsolvable issues by finding the highest value for the `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 of `shadow.hpp` in [this branch](https://github.com/AnyOldName3/openmw/tree/osgshadow-test-vdsm-clsb-meddling) 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.\r\n- [ ] Adjust the alpha test such that invisible actors cannot cast a shadow.\r\n- [ ] Work out the cause of and then get rid of messages about an invalid OpenGL state.\r\n- [ ] Resolve this issue https://github.com/OpenMW/openmw/pull/1547#issuecomment-379163614\r\n- [ ] Fix this again https://github.com/OpenMW/openmw/pull/1547#issuecomment-388719679\r\n\r\n## Non-blockers\r\n- [ ] At night shadows need to be tweaked in some way if anyone other than me starts complaining about them (as another fake light source is used at night, too).\r\n* - [ ] Maybe the position of the light source should follow one of the moons.\r\n* - [ ] Maybe the diffuse component of the light source should be reduced and the ambient one increased.\r\n- [ ] Investigate disabling lighting calculations when rendering the shadow map for a speed boost.\r\n- [ ] Consider using a big PCF filter as an option to soften shadows and/or make undersampling look less bad.\r\n- [ ] Consider potential systems to avoid wasting shadow map space on distant stuff.\r\n* - [ ] Maybe a heuristic in QuadTreeWorld based on maximum steepness in a cell and the angle of the sun in the sky which affects the `ComputeLightSpaceBounds` visitor.\r\n* - [ ] Maybe just a boring maximum shadow map distance setting.\r\n* - [ ] As distant statics don't exist yet, there's no good way to theorise about the ideal solution for these and if it's just going to be as simple as having a `distant statics shadows` setting.\r\n\r\n**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.**\r\n  \r\n  "},"comment":{"url":"https://api.github.com/repos/OpenMW/openmw/issues/comments/390340174","html_url":"https://github.com/OpenMW/openmw/pull/1547#issuecomment-390340174","issue_url":"https://api.github.com/repos/OpenMW/openmw/issues/1547","id":390340174,"user":{"login":"AnyOldName3","id":8485112,"avatar_url":"https://avatars1.githubusercontent.com/u/8485112?v=4","gravatar_id":"","url":"https://api.github.com/users/AnyOldName3","html_url":"https://github.com/AnyOldName3","followers_url":"https://api.github.com/users/AnyOldName3/followers","following_url":"https://api.github.com/users/AnyOldName3/following{/other_user}","gists_url":"https://api.github.com/users/AnyOldName3/gists{/gist_id}","starred_url":"https://api.github.com/users/AnyOldName3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AnyOldName3/subscriptions","organizations_url":"https://api.github.com/users/AnyOldName3/orgs","repos_url":"https://api.github.com/users/AnyOldName3/repos","events_url":"https://api.github.com/users/AnyOldName3/events{/privacy}","received_events_url":"https://api.github.com/users/AnyOldName3/received_events","type":"User","site_admin":false},"created_at":"2018-05-18T21:41:38Z","updated_at":"2018-05-18T21:41:38Z","author_association":"CONTRIBUTOR","body":"Guys, please check this out: https://github.com/AnyOldName3/openmw/tree/osgshadow-test-dicking-around-with-cascading-shadow-maps\r\n\r\nI'm a bit drunk, so somehow changed the behaviour of shadows while refactoring something and it seems to have magically fixed a zillion things by accident."}}
{"actor":{"display_login":"AnyOldName3"}}