-
Notifications
You must be signed in to change notification settings - Fork 773
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
[d3d9/d3d11] add samplerLodBias to d3d9 and clampNegativeLodBias for both d3d9 and d3d11 #3435
Conversation
3569dc5
to
28dd16f
Compare
Oh my god, I can't believe there is any progress happening on this issue! for years we have shimmering in old games on modern video cards, and the only solutions was to use old Windows with outdated drivers or use an old 2008~2009 video card with NegativeLodBias "clamp" for example 8800 gt, gtx 285... Thanks Lilium and Andon M. Coleman for taking the time to create a solution |
@ViNi-Arco what value did you use? I think positive values are less sharp, so you'd want to use that. |
Vice city is d3d8 馃 |
I used this anisotropic filtering and lod bias tester to verify that it is indeed working: While also trying a few games where it applied correctly too. |
Sup Blisto, I always use D3D8to9 because of Skygfx and rwd3d9 and other mods..
I do not understand what you want to know, you speak of lod bias? |
Hello dear, I will test in more games to see how lod behaves in them |
I wrote a quick logger for the lod bias the game supplies and the one you overwrite with the conf options: looks like this:
|
I tested it on the NFS Carbon, and it doesn't seem to be able to identify the lods of the games, look at the log:
Reports as 0 on all Edit: I will test more d3d9 games, especially those from 2004 or older, to see if the log reports anything |
The clamp option doesn't work for me in Filter Tester, negative LOD still can be used: It's D3D10 32 bit and you need a Wine version with Vulkan child window support. Perhaps it would also be possible to offer more control for the clamp: |
So, any real example where the clamp helps? |
Well, if the clamp doesn't work (i.e. if the Filter Tester case above applies in general), it can't be demonstrated. |
@aufkrawall
|
I am following the previous work for applying a lod bias by @doitsujin here |
I guess not? 馃槄 |
@ViNi-Arco iirc there is a option in D3D9 to automatically create mip maps for textures that don't have any. |
Wow, so Nvidia's "Negative LOD Bias" option did a lot more under the hood. Thank you very much for looking into this |
Honestly I am not quite sure if it is automatically created mip map levels. |
Ah yes, the Magic.TXD, but just applying mipmap even at maximum texture levels, which is what I'm using in GTA SA, doesn't totally solve the shimmering problem, the game applies a negative Lod yet: Even with mipmap it has shimmering.. Edit: I tested it now and the
|
ok some more guesses: typedef enum _D3DTEXTUREFILTERTYPE {
D3DTEXF_NONE = 0,
D3DTEXF_POINT = 1,
D3DTEXF_LINEAR = 2,
D3DTEXF_ANISOTROPIC = 3,
D3DTEXF_FLATCUBIC = 4,
D3DTEXF_GAUSSIANCUBIC = 5,
D3DTEXF_PYRAMIDALQUAD = 6,
D3DTEXF_GAUSSIANQUAD = 7,
#ifndef D3D_DISABLE_9EX
D3DTEXF_CONVOLUTIONMONO = 8,
#endif
D3DTEXF_FORCE_DWORD = 0x7fffffff
} D3DTEXTUREFILTERTYPE; while Vulkan only supports linear and point (= nearest in Vulkan) and dxvk does too. |
the shimmering comes from dxvk/Vulkan only supporting nearest or linear filtering and not from the lod bias. edit: |
The case here with games that support mipmap is the filtering problem not just the lod itself, there are ways to force these filters on games on Linux, I will test some to see how they affect the appearance here..
What about games that don't have a mipmap or have a way to inject mipmap as is possible with Magic TXD, these filters would be the only option? |
only 0-3 are supported in Vulkan and therefore dxvk. the others all get mapped to linear because there is no equivalent. Please stop posting about this here since it has nothing to do with this PR anymore. Thank you! |
I am not sure if clamping a positive lod bias makes sense since you would get shimmering on those textures then. the lod bias option seems to make the most sense with older games at higher resolutions. I am not sure if clamping the negative lod bias was ever something that brought a positive outcome unless for that NV driver hack. I will convert this to a draft and get some more opinions to see what is the best to do here :) |
Perhaps only c0ed265 can be merged in the meantime? It makes sense to set a negative LOD bias with |
28dd16f
to
51cb45c
Compare
I noticed there is Fetch4 hack which relay on lod bias value, worth to check if it will not break with |
as I understand the code this should not cause any issues with this PR. the only thing I could maybe do is only apply the lod bias on linear filtered textures like it's done in d3d11 as fetch4 checks if the texture magFilter is point edit: |
nothing really changed with 51cb45c except to match the styling of everything else |
51cb45c
to
6cf9bed
Compare
6cf9bed
to
4e5238e
Compare
all the merge issues are resolved :) |
Thank you very much @EndlesslyFlowering @Kaldaien I wish you all the best |
d3d9.clampNegativeLodBias
addresses #2779a negative lod bias can help for some d3d9 games to look better
while clamping the negative load bias can also help some other games too 馃槃
Thanks to @Kaldaien for giving me the code for clamping in D3D9!