Friday, January 8, 2021

Antialiasing with DXVK and GTA IV

This antialiasing method is very simple and uses older Sweetfx that is based on injectSMAA. 

  • SweetFX antialiasing works for fairly modern GPUs e.g. very good at rx580, OK at gt730. 
  • It is not CPU hungry and works without significant fps degradation even on 2-core Athlon X2. 

Latest Reshade may also be used for Vulkan antialiasing but it is harder to install/configure and at the moment it works only in global mode e.g. it will affect all games that output through Vulkan. 

How-to enable DXVK antialiasing

  1. Get  SweetFX 1.5u Boulotaur2024.Injector that will chainload DXVK dll
  2. Rename DXVK dlls installed in game folder:
    d3d9.dll as d3d9_dxvk.dll
    dxgi.dll as dxgi_dxvk.dll
  3. Unpack downloaded SweetFX archive and copy everything except X64_dll's into game folder:
    • SweetFX subfolder
    • d3d9.dll
    • SweetFX_preset.txt
    • SweetFX_settings.txt
  4.  Edit SweetFX_settings.txt "Misc settings" section at the end and specify your renamed DXVK dll here as:

    // external_d3d9_wrapper = d3d9_dxvk.dll

    ATTENTION! The line must remain commented with // and it is not a mistake!
  5. Launch the game

Once in the game you may use following  keys

  • Ins - enable/disable SweetFx. By default it is enabled on startup.
  • End - screenshot
  • Del - reload SweetFX
To check if AA works come up to any table in Niko's apartment and press Ins to disable AA - you should see jaggies appear at the edges of the table, press Ins once again to reenable AA.
 

Troubleshooting

If the game freezes on startup it may be because of SweetFX+DXVK initialization -  press Del to reload it and the game should launch. 

If the game shows D3D9 error try renaming dxgi.dll from SweetFX as dxgi_sweetfx.dll

60 comments:

  1. зачем использовать древний sweetFX когда уже 100 лек как есть reshade

    ReplyDelete
    Replies
    1. Все написано выше - решейд для вулкана работает в глобальном режиме и для его установки нужны админские полномочия. Свитэфектс ставится проще и только для гта4. В любом случае решейд это немного переделанный свитэфектс и я не думаю что в коде SMAA шейдера там что-то революционно улучшилось.

      Delete
  2. Do I have to edit "// external_dxgi_wrapper" to "// external_dxgi_wrapper = dxgi_dxvk.dll" aswell? Thanks!

    ReplyDelete
    Replies
    1. You may do that but apparently the game does not use dxgi.dll from DXVK and works without it.

      Delete
  3. How can I increase the quality of AA? It looks better but still not good

    ReplyDelete
    Replies
    1. You may tinker with SMAA settings in SweetFX_settings.txt. Maybe also enable FXAA there.

      If your GPU is powerful enough consider DSR or VSR and set 4k resolution in game.

      Delete
  4. Hi anton, good 2 see u again mate. i have one question in this thread regarding general information of sweetfx. I want to know that if i disable sweetfx in game by pressing shortcut key and then quit the game and reopen the game again then sweetfx will remain disabled or sweetfx will enable its own function itself everytime after launching the game?

    ReplyDelete
  5. One more thing, i have noticed one thing while running gta iv with sweetfx, icenhancer 3.0 version 2014 and 4k dsr which is when i toggle sweetfx off and back to on, i dont notice any difference in game neither in visuals nor in performance. Do you have any idea what it can be? I have installed sweetfx properly and tried to give different Javascript key char code to bind toggling of sweetfx to other keyboard switches. But no luck. Any idea to check my sweetfx is either way working or not?

    ReplyDelete
    Replies
    1. Hello, Jason. I see that your setup is too complex.
      In general specialized ENB for GTA is better than generic SweetFX. Basically if you go with Icenhancer/ENB it will have d3d9.dll from ENB and built-in antialiasing which you should disable in enbseries.ini as with 4k resolution you probably don't need another antialiasing. The problem with ENB is you may have no way of chainloading DXVK.

      If you installed SweetFX first then ENB's d3d9.dll from Icenhancer will overwrite it and SweetFX will no longer work - it activates on startup only if you have d3d9.dll from SweetFX.

      Delete
    2. You are right mate, i made my game directory complex. in my case use of sweetfx is not needed as 4k dsr is more than enough for providing antialiasing in gta iv and at the same time sweetfx was not working bcoz chainloading three d3d9.dll (one of dxvk, one of enb and last one of sweetfx) is not possible most probably in gta iv. So i think you can run maximum two d3d9.dll at the same time using proxy method. So in my case files of sweetfx are redundant and i removed it from my game directory and during my tests, i have noted that if i use only enb and sweetfx and not dxvk's dll then sweetfx works and it creates some data in log.log file and i was able to check whether sweetfx was working or not by noticing anti-aliasing effects by toggling sweetfx on/off. And one more thing i have noted is that, sweetfx loads its smaa shaders every time you launch the game even if you have disabled sweetfx's shader code in last session of the game. Thanks for the tip mate.

      Delete
  6. It does not work for me, it still does not apply SMAA

    ReplyDelete
    Replies
    1. Try reloading SweetFX in game by pressing Del. It rarely does not initialize on startup. Works OK for me on both AMD and nVidia GPUs.

      Delete
  7. Антон, добрый день
    у вас был пост про про XlivelessAddon, но он не подходит для Complete Edition. Пожалуйста, посоветуйте что-то для Complete Edition
    Спасибо

    ReplyDelete
    Replies
    1. Я не совсем понимаю, чего вы хотите достичь. Самое лучшее, что вы можете сделать для Complete Edition это поскорее сделать даунгрейд на 1.0.7.0. Если без даунгрейда то тогда посоветую https://cs.rin.ru/forum/viewtopic.php?f=10&t=73023&start=525 (cracked GTAIV.exe) + https://cs.rin.ru/forum/viewtopic.php?f=10&t=105319 (RGSC emulator)

      Delete
    2. Антон, пожалуйста, уточните почему вы рекомендуете даунгрейд, 1.0.7.0 самая стабильная версия? после даунгрейда останется все из Complete Edition?

      Delete
    3. Антон, хотел еще у вас уточнить касательно IV.EFLC.ColAccel v1.5
      Это действтельно помогает, я не заметил разницы.
      И будет ли ColAccel корректно работать с dxvk+dxwrapper.
      Спасибо!

      Delete
    4. По моему мнению 1.0.7.0 самая стабильная на новом железе. Если сделать даунгрейд с новым радиодаунгрейдером и ZolikaPatch (он фиксит зависание после Concrete jungle) то должно остаться всё.
      Насчё ColAccel сказать сложно, народ пишет что он может рушить сейвы и переносит некоторые здания/структуры куда не надо. Я пробовал, если установить его до начала новой игры и больше не устанавливать никаких новых модов в процессе игры, то вряд ли у вас будут какие-то проблемы с ним.

      Delete
    5. Используйте либо DXVK либо Dxwrapper, но не вместе.

      Delete
  8. Hey Anton! Its Cyrix from that 1040 downgrade post. Um i actually DID a fresh install of GTA 4 Fitgirl Repack Patch 1080. AND thought of boosting my fps with DXVK. But idk why or if this is normal. My game stutters a lot. I read that its normal but i have run the games more than 3 times now for little intervals like 30 mins. the benchmark fps results are good but the game feels choppy/stuttery a lot. I fixed Jagged edges using SweetFX but can u help me with this FPS thing

    ReplyDelete
    Replies
    1. IT DOESNT feel smooth. should i use a heli and flyover every part of the city to let it build up that shader cache???

      Delete
    2. Are you on 1.0.8.0 now? What are your CPU, GPU, RAM, OS, driver version?
      You should remove all .asi files including ZolikaPatch, remove SweetFX, leave only d3d9.dll from DXVK and maybe FusionFix's .asi file, turn ingame vsync off. Cache builds fast, launch the game, drive a little, exit, on next game launch cache should be loaded and it should be smooth. If DXVK still stutters it means some monitor sync problem. Read similar comments and follow mentioned URLs under stutter fix post, I can't help any more than that.

      Delete
    3. 😅 No i still GTA 4 1040 but i wanted to play some GTA Connected thats why i did a fresh install of 1080.

      Specs

      CPU Intel i7 8750H @ 2.2GHz
      GPU 4 GBGeforce GTX 1050 + Intel HD Graphics
      16 GB DDR4 RAM
      Windows 10
      Geforce Driver v466.27

      Should i also remove DxWrapper??

      Delete
    4. You should not use dxwrapper with DXVK, the methods in stutter fix guide are mutually exclusive. Your specs are good but you need to experiment with -availablevidmem ... to make sure that game uses your Nvidia GPU and not Intel iGPU.

      Delete
    5. I think my game uses NVIDIA GPU as far as i can tell. And will using DXVK without DxWrapper help with the stutter for shader cache? As this is Patch 1080 i put availablevidmem as 4096. The game is very smooth in GTA Connected but not that great in GTA 4 SP. I will try your solutions and reply about any changes :)

      Delete
  9. I have already installed injectSMAA 1.2 in GTA 4. Will it still work after I set up the DXVK method? And what are the advantages of SweetFX when compared to injectSMAA in terms of AA? Thanks in advance.

    ReplyDelete
    Replies
    1. DXVK will replace injestSMAA's d3d9.dll that's why SweetFX's d3d9.dll which supports chainloading of DXVK's renamed d3d9.dll is needed (this chainloading is SweetFX's main advantage). As for SMAA quality the SweetFX's shader is based on injestSMAA so they are nearly identical code-wise.

      Delete
  10. Someone managed to get DXVK and IceEnhencer work together but from a 1.0.4.0 version from the DVD release. I can't get it to work on my regular latest version from Steam.

    ReplyDelete
    Replies
    1. Mods usually don't work out of the box on 2020 Complete Edition.
      I also managed to to get DXVK and IceEnhencer work together both for 1.0.4.0 and 1.0.7.0, you may either upgrade the retail version or properly downgrade the 2020 Complete Edition. RTFM https://ant-sh.blogspot.com/2021/05/enb-with-dxvk-for-gta-iv.html

      Delete
  11. I get the error "Cannot load either system d3d9 dll or external d3d9 wrapper dll"

    ReplyDelete
    Replies
    1. Post link to screenshot with this error shown. Also post your specs and how DXVK d3d9.dll works alone without SweetFX.

      Delete
  12. Do you have any clue why Reshade won't work with DXVK for me? I choose Vulcan for GTA4.exe in the setup but Reshade's prompt doesn't show up in-game. If I uninstall DXVK, then Reshade (in DX9) will work however the game becomes totally unplayable with an unresponsive image (but stuff still happens in the background because I can hear it).

    ReplyDelete
    Replies
    1. The last time I tried to install it Reshade required admin privileges to install in global mode for Vulkan. I did not test Reshade with DXVK so I don't know anything about that.

      Delete
  13. error "Cannot load either system d3d9 dll or external d3d9 wrapper dll"

    ReplyDelete
    Replies
    1. Hello, this error means that DXVK dll has trouble loading. I sometimes had this on fresh install. You should try removing and reinstalling GPU drivers and running DXVK without SweetFX as per stutter fix guide here to make sure that game runs OK. Then SweetFX will work too.

      Delete
  14. Hi
    This work to get some antialising but produces another issue.
    I cannot get Rockstar Launcher to load-up in game and therefore I'm unable to log into it if I use this workaround - it seems to break when I replace the DXVK's d3d9.dll with SweetFX's.
    Any ideas please?

    ReplyDelete
    Replies
    1. As in if the DXVK's d3d9.dll is no longer in place and it is replaced by SweetFX then Rockstar Launcher can't seem to hook into the game, so can't use my existing saves, save progress, or sync to cloud etc.

      Delete
    2. Hello Andras, it looks like last update broke lots of things including ENBs.
      The most reliable solution is to avoid RGL and use cracked exe and RGSC emulator https://cs.rin.ru/forum/viewtopic.php?p=2504320#p2504320 and take release build of socialclub.dll from this archive https://cs.rin.ru/forum/viewtopic.php?p=2487923#p2487923

      Delete
  15. Hey Anton, thanks for the post. I have some questions. First, I already have DXVK installed and want to install SweetFX. Will the cache I have built up right now be wiped and started from the beginning or it won't be affected? Second, I have a timecycle mod called Sweet Autumn that seems to make the world much clearer, will this interfere with SweetFX? And finally, does SweetFX put a lot of pressure on performance? My gig is RX580 8gb, E5 3.6ghz.
    Thanks in advance.

    ReplyDelete
    Replies
    1. Hello again, DXVK state cache is not affected by installing SweetFX. Pure timecyc mods usually do not interfere with anything including SweetFX. Performance hit is very hard to notice on gt730, on RX580 you won't feel any performance hit at all.

      Delete
    2. Thanks for all the info. How well does SweetFX work? I have anti-aliasing turned on in Radeon Adrenalin (GPU driver) and it seems to make the game cleaner somewhat.

      Delete
    3. You are welcome. I tried different Radeon Software AA options in override app settings mode and the only one that worked for me in default D3D9 was Morphological AA which is too smeary for my taste. Unfortunately none of them including Morphological AA work with DXVK.
      SweetFX and DXVK work very good for me at VSR 2560x1440 on FullHD monitor in tandem with Radeon's Sharpness 70-80%.

      Delete
  16. Have you had any trouble with Rockstar Social Club after adding SweetFX?

    ReplyDelete
    Replies
    1. Hello, Matthew! I use older version of the game without RGSC. Latest anticheat RGSC update broke graphics mods that inject shaders e.g. ENB or SweetFX. You have to use cracked exe and RGSC emulator or downgrade.

      Delete
  17. Hello! I'm using DXVK and everything works properly, but the game black screen and close (without error message) when using sweetfx. I tried with " // external_d3d9_wrapper = d3d9_dxvk.dll " and without, game still black screen and crash, can't figure out what's causing the game to crash. Logs are only showing: " [22:42:45] Redirecting CreateDevice : successful (width: 1920, height: 1080)
    [22:42:45] Initializing SMAA (width: 1920, height: 1080)...
    [22:42:45] SMAA enabled
    [22:42:45] Device->Reset succesful ! [width: 1920, height: 1080]
    [22:42:45] Initializing SMAA (width: 1920, height: 1080)...
    [22:42:45] SMAA enabled"

    ReplyDelete
    Replies
    1. Hello, Kuri! The log indicates that SweetFX loads OK and I have identical lines in my log. However if you have trouble using SweetFX even in default D3D9 mode without DXVK it means one of the following:
      - Rockstar Launcher's anticheat conflicts with it (read above comments for what you can do about it)
      - driver or OS issue. Install latest cumulative update for your OS, DDU and manually install the latest GPU driver.

      Delete
  18. Hello. I got the error (The Application Was Unable to Start Correctly (0xc000007b) after i installed SweetFX 1.5u Boulotaur2024.Injector. Seems like the dll files in the injector causing the problem but my game running fine after i remove the dll files and rename the two _dxvk.dll files back to original.

    ReplyDelete
    Replies
    1. Hello, Dave! This means that SweetFX dll needs some x86 Visual C++ runtime. For good measure download and install them all https://www.techpowerup.com/download/visual-c-redistributable-runtime-package-all-in-one/

      Delete
    2. Its Work. Thank you sir and best of luck to you : )

      Delete
  19. pretty sure rockstar launcher breaks this method. gets an error "the procedure entry point Direct3DCreate9Ex could not be located in the dynamic link library C:Program Files (86x)\Rockstar Games\Social Club\libcef.dll"

    ReplyDelete
    Replies
    1. It worked OK in 2021 when I wrote this post. In 2022 they added anticheat that messes with many 3rd party injectors including SweetFX. Read my 16 April 2022 response above for some useful links.

      Delete
  20. Hi, this isn´t working with newest version ? Installed it like this: https://imgur.com/UG7WdQY
    Getting this error: https://imgur.com/YXMEUPI
    Thanks for answer.

    ReplyDelete
    Replies
    1. Hello, it is because of Social Club. You need to find a way to launch the game without it https://ant-sh.blogspot.com/2021/01/antialiasing-with-dxvk-and-gta-iv.html?showComment=1650069196143#c6952009728281294428

      Delete
    2. А у меня кароче стим версия, и не смотря на то что оно в обнимку с ргс\ргл моды робят, решейд тоже, но его методы сглаживания завазелинивают интерфейс, а свит эфыкс не работает ваще: игра показывает текст дисклеймер, висит чуть-чуть и вылетает. И главное лог пишет что когда я del тыкал оно преспокойно перезапускалось. Неужто и тут этот античит галимый виноват? С ачивками играть хочеца(

      Delete
  21. Нужно использовать кряк с поддержкой достижений стима https://cs.rin.ru/forum/viewtopic.php?p=2504320#p2504320 и socialclub.dll из старого кряка https://cs.rin.ru/forum/viewtopic.php?p=2144950#p2144950

    ReplyDelete
    Replies
    1. Вот ж маразм галимый я в шоке, чисто мув компании фагот стар

      Delete
    2. так стоп может я ступил, первая ссылка вроде правильный, там экзешник все дела и дллки, а по второй ссылке архив чисто с экзешником. Не напутал ли чего?

      Delete
    3. да напутал, бывает, нашел твой ответ от 16 апреля одному пацану, буду пробовать, ибо smaa хочеца. А оно кстати интерфейс не поганит как тот же решейд?

      Delete
    4. Я в шоке просто пушка, и интерфейс вроде в порядке, только вот куда сохранения делись, вроде всё так же лежат в документы\магостар\гта4\профили, но игра их не видит. и да у меня были включены облачные сохранения в том числе. Оно рабочую директорию сменило да, но на какую? Аппдата тоже пуста

      Delete
    5. Разобрался, пацанам на заметку, тк это эмуль от голберга то и сохраненки лежат в другой папке, а именно: C:\Users\имя юзера\AppData\Roaming\Goldberg SocialClub Emu Saves\GTA IV\0F74F4C4

      Delete
    6. Извиняюсь за спам, структурировал бы в одно всё соообщение. Вообщем что по итогу: этот кряк еще и производительность повысил, я замерял уже с включенным смаа на максималках. Просто золотой человек антон, и тот кто кряки сделал. Кстати про проблему с сохранениями да и про кряк этот можешь добавить в статью, обновить так сказать. Спасибо, легенда

      Delete