Commit Graph

67 Commits

Author SHA1 Message Date
AnyOldName3 98291f1377 First batch of warning fixes 2025-09-18 00:38:08 +01:00
AnyOldName3 47fff7f998 Disable shadows even harder
On GPUs that can detect when all fragments in an execution group take the same branch, this might run faster. Even if it doesn't, it might suppress any weirdness coming from sampling the dummy shadow maps.
2025-05-19 15:06:19 +01:00
Alexei Kotov f0e4793321 Remove allow shadow map overlap setting (#7939) 2024-04-26 13:50:03 +03:00
AnyOldName3 3335ccbc32 Capitulate 2024-02-20 23:51:42 +00:00
AnyOldName3 8c92f6ee87 Make uniform a signed int again 2024-02-20 23:10:23 +00:00
AnyOldName3 d282fdb77a Eliminate unused uniform 2024-02-20 23:10:03 +00:00
AnyOldName3 132c43affa Fix warning
Also attempt to make an equivalent warning fire with MSVC, then have to fix other stuff because /WX wasn't working, then back out of enabling the warning because none of the ones I could find disliked the old code.
2024-02-20 22:14:13 +00:00
AnyOldName3 7391bf2814 Fix OpenGL errors
There's no reason to use the AndModes variant as we never (intentionally) attempt to sample from a shadow map via the FFP.
2024-02-20 21:23:23 +00:00
AnyOldName3 535c5e328a Affect correct texture units when disabling shadows for stateset
Knowing which are right required making the function non-static, so the shadow manager had to become a singleton as the results of passing it around to where it's needed were hellish.

I'm seeing a bunch of OpenGL errors when actually using this, so I'll investigate whether they're happening on master.
I'm hesitant to look into it too much, though, as I'm affected by https://gitlab.com/OpenMW/openmw/-/issues/7811, and also have the Windows setting enabled that turns driver timeouts into a BSOD so a kernel dump is collected that I can send to AMD.
2024-02-20 21:02:31 +00:00
elsid f4efbcc1c4
Use settings values for Shadows settings 2023-11-02 16:36:44 +01:00
Bret Curtis ff6944701f Be more explicit about use of CLAMP_TO_EDGE instead of defaulting to GL CLAMP 2023-06-16 09:16:07 +02:00
Mads Buvik Sandvei fe066069d7 /components/ code should not access the stereo manager without checking whether or not stereo is enabled first. Stereo component code should not read settings itself, but rather take settings as parameters. 2023-04-22 16:11:42 +02:00
AnyOldName3 83b940397e AdD lInE bReAk ThAt ClAnG-fOrMaT wAnTeD 2023-02-10 00:12:55 +00:00
AnyOldName3 7d4410d4fb Use reserveGlobalTextureUnits for shadow maps 2023-02-09 01:32:48 +00:00
AnyOldName3 80d6f6bc97 Add line break that clang-format wanted 2023-02-05 02:07:00 +00:00
AnyOldName3 0edc8fc77d Don't use FFP-friendly texture image units for shadow maps
This more-or-less gets rid of the shadow system's only depencency on FFP
stuff. All that remains is it using OSG cameras, which OSG provides a
uniform-based implementation of, too, which we can trivially migrate to.

This should mean we're not eating any of the ~8 FPP-friendly texture
units, which is good as Morrowind models can use all of those on their
(although they very rarely do), and instead use some of the ~160
shader-only texture image units. This just requires not calling
glEnable(GL_TEXTURE_2D), accomplished by changing
setTextureAttributeAndModes to setTextureAttribute.

Also changes from using glTexGen and its eye plane matrices to pass the
shadow space matrix for each light to explicit uniforms. Thankfully, the
maths was a simple combination of the valid region matrix and eye plane
matrix maths.

As of this commit, I believe this kills shadows in one eye for stereo
rendering.
2023-02-05 00:40:33 +00:00
clang-format-bot ddb0522bbf
Apply clang-format to code base 2022-09-22 21:35:26 +03:00
Evil Eye 2222b47e3d Make Settings::Manager::getString return a reference 2022-08-28 16:38:11 +02:00
elsid f99ed6f1db
Split components/misc/stringops.hpp into multiple headers
Replace all ciEqual overloads with one having std::string_view as argument.
2022-08-03 22:06:24 +02:00
madsbuvi dd5901d351 Initial commit
Multiview shaders.

Refactor Frustum management

Rewrite shared shadow map

cull mask should respect stereo

Stereo savegame screencap

LocalMap refactoring

use the vertex buffer hint instead of the display list patch to enable/disable display lists

Character preview fixes
2022-04-28 21:05:34 +02:00
Alexei Dobrohotov 7a0c13fcf8 Make better use of std::clamp 2021-11-06 08:47:32 +03:00
Bo Svensson 98f8295765
allows to skip ComputeLightSpaceBounds traversal (#3152)
Currently, we always traverse the scene graph an additional time with a ComputeLightSpaceBounds visitor during shadow casting. ComputeLightSpaceBounds is only useful when the shadow casting mask allows us to shrink the bounds of the rendered scene, so we guard its traversal with a check against getCastsShadowTraversalMask. In practice, this guard never works because we build the traversal mask inclusively.

With this PR we limit the getCastsShadowTraversalMask check to relevant masks. This new check allows us to skip a superfluous ComputeLightSpaceBounds traversal with most settings.
2021-10-11 11:27:50 +02:00
AnyOldName3 37661bffea Merge branch 'shadowdisable-fix' into 'master'
Make disableShadowsForStateSet a no-op when shadows are disabled

See merge request OpenMW/openmw!205
2020-11-18 18:56:36 +00:00
AnyOldName3 7768556ce6 Set dummy state when disabling shadows indoors
As we don't reconfigure all shaders without shadows when we disable them
indoors (as it'd probably add a hitch to transitioning in and out) we
need to set up dummy state so the shaders don't do anything illegal.

This hadn't had symptoms for most objects as when indoors, nearly
everything would be drawn first in one of the water RTTs, which had
dummy state to disable shadows already. This wasn't true of the water
plane itself, though, yet somehow it took until just now for anyone to
report that.

This resolves vtastek's issue where the water would be invisible indoors
2020-11-16 21:01:20 +00:00
Icecream95 f14db21745
Make disableShadowsForStateSet a no-op when shadows are disabled
Otherwise the GPU has to do useless shadow comparisons when shadows
are disabled.
2020-05-17 19:52:23 +12:00
Bret Curtis 5f0f2f0f16 rename to better reflect what is going on per AnyOldName3 comment; added none option 2020-05-01 00:34:31 +02:00
psi29a bb5fe13e13 Make sure it is either one or the other with the default to bounding volumes. 2020-04-29 23:06:44 +00:00
Bret Curtis d38c3e971c remove extra line 2020-04-29 17:05:08 +02:00
Bret Curtis ae729a1ac7 add ability to set the type of near far method to be used in shadow calculation; default to bounding volumes; cleaned up code while there and re-ordered items 2020-04-29 16:36:48 +02:00
bzzt dc33eeadf1 tightscenebound is uncessary after water bbfix 2020-04-27 08:42:46 +02:00
Bret Curtis 8a8107e837 as it says; revert vismask and uncomplicate openmw 2020-04-20 20:57:38 +02:00
Andrei Kortunov 84979fa8b7 Move VisMask to components 2020-02-16 16:03:35 +04:00
Andrei Kortunov f09d20434c Clamp number of shadow maps 2019-11-17 17:25:02 +04:00
Andrei Kortunov 7074baa1c2 Clamp number of shadow maps, as described in docs 2019-11-13 15:10:22 +04:00
bzzt b6ed2f1718 Add optional shadow map max distance and fading 2019-11-02 18:06:39 +03:00
AnyOldName3 cfe921fb82 Remove uneeded includes. 2019-01-31 20:12:42 +00:00
AnyOldName3 2761a38562 Prettify shadow define map setup. 2019-01-31 20:12:17 +00:00
AnyOldName3 57e10e26b2 Make variable name less confusing 2019-01-31 14:58:57 +00:00
AnyOldName3 a24b8ec3d2 Fix enable/disable mixup. 2019-01-31 14:57:56 +00:00
AnyOldName3 556c9a3382 Add normal-offset shadow mapping to remove shadow acne (flicker) 2019-01-30 22:28:00 +00:00
AnyOldName3 199e6ed82d Revert "Use forward declaration to reduce build times."
This reverts commit 305b9826df.
2018-12-19 23:53:14 +00:00
AnyOldName3 305b9826df Use forward declaration to reduce build times. 2018-12-19 16:23:32 +00:00
AnyOldName3 2d5da1a6fa Don't exclusively rely on a shadow map if its bounds have been expanded since the cull traversal. 2018-12-08 20:39:41 +00:00
AnyOldName3 0a409c0ab8 Make shadow map front-face culling configurable 2018-12-01 00:26:43 +00:00
AnyOldName3 dd207d9e54 Make the shadow polygon offset parameters configurable 2018-11-30 00:55:54 +00:00
AnyOldName3 1ca7ea23d1 Add extra uniforms to the disabled shadows StateSet so that the shadow texture samplers are bound ot the dummy shadow maps correctly. 2018-10-30 17:07:11 +00:00
AnyOldName3 474770eca8 Switch shadow map rendering to a specialised, simplified shader. 2018-10-16 21:23:31 +01:00
AnyOldName3 3b3721897d Make indoor shadows disableable. 2018-08-08 23:56:11 +01:00
AnyOldName3 85aba2e1da Add toggleable shadow debug overlay. 2018-06-28 17:24:36 +01:00
AnyOldName3 84284a60a7 Make CSM shader changes controllable by the setting. 2018-05-17 17:35:55 +01:00