Skip to content

Shadow of War: HDR and more#157

Draft
XgarhontX wants to merge 33 commits into
Filoppi:mainfrom
XgarhontX:shadowofwar
Draft

Shadow of War: HDR and more#157
XgarhontX wants to merge 33 commits into
Filoppi:mainfrom
XgarhontX:shadowofwar

Conversation

@XgarhontX

@XgarhontX XgarhontX commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

DON'T ACCEPT YET!

HDR

SR

  • Allow ignore_upgraded_samplers toggle
    • Since I don't notice major benefits with it, and it also changes distant material LOD params.
  • Toggle for CopyResource() to fix missing bloom and stuff when using Depth of Field.
    • Just in case, since it's always broken on my end...

Others

  • UI & "scene color after tonemap" resources indirect upgraded 16f.
  • Photo Mode Contrast shader uses RenoDX Contrast instead of whatever they had that clips HDR.
  • RCAS
  • Bloom and God Rays sliders.
  • UI Toggle
  • Retuned Fire
    • Modded a bunch of fire shaders to reduce clipping (from flame color gradient LUT sampling).
    • Since it changes style, user can disable (though it just breaks the shaders from compiling rn).

Cleanliness?

  • I still need to clean up Shaders folder.
  • I tried to compartmentalize the new stuff. Idk if it's more confusing.
  • I reformatted so that your DLSS handling code indentation is the same as everything else in Luma.

TODO

  • Alternative AO.
  • Fix vanilla TAA artifacts to black for extremely bright pixels.

Luma Tab

  • Ofc, SDR will hide unused.
Screenshot 2026-07-18 231613

Retuned Fire

  • Off vs On
Clipboard Image (1) Clipboard Image (4)
  • Obvi, way more impactful in HDR.
Clipboard Image (6) Clipboard Image (5)

Comment thread Source/Games/Middle-earth Shadow of War/main.cpp
device_data.has_drawn_sr = sr_implementations[device_data.sr_type]->Draw(sr_instance_data, native_device_context, draw_data);

// Copy back to input, fixing missing transparency FXs.
if (SRUser::copy_resource) native_device_context->CopyResource(resource_scene.get(), resource_rt.get());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really necessary?
Maybe the issue is how DLSS handles alpha.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's that unoptimized to have the branch not execute, the ok, del it. Otherwise, I can't get bloom to show unless I use that on my end.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you test copying alpha of the scene to the DLSS output, after DLSS runs. The original TAA copies alpha from the scene to the output.

Comment thread Source/Games/Middle-earth Shadow of War/main.cpp Outdated
@garamond13

Copy link
Copy Markdown
Collaborator

I couldn't compile on my end, Luma CB hell.

I don't think having too many namespaces helps with organization and readability. Some is in namespaces, some global (unnamed namespace), some is in struct GameDeviceDataMiddleEarthShadowOfWar, than replication of functions like OnPresent.

Overall if it all works fine (couldn't test on my end, can't compile), it's fine with me.

@XgarhontX

Copy link
Copy Markdown
Contributor Author

I couldn't compile on my end, Luma CB hell.

I don't think having too many namespaces helps with organization and readability. Some is in namespaces, some global (unnamed namespace), some is in struct GameDeviceDataMiddleEarthShadowOfWar, than replication of functions like OnPresent.

Overall if it all works fine (couldn't test on my end, can't compile), it's fine with me.

I'll clean it up more when I get home. A lot of the namespace meant to be more complicated until I figured out how to reduce. Like DisplayMode used to be way crazier, handling branching between vanilla HDR and SDR mode until I found that HDR mode is beyond repair.

@XgarhontX

Copy link
Copy Markdown
Contributor Author

I couldn't compile on my end, Luma CB hell.

I thought you included the file already lol, since you had GameCBuffers created already, so I forgot to push vcxproj.

I don't think having too many namespaces helps with organization and readability. Some is in namespaces, some global (unnamed namespace), some is in struct GameDeviceDataMiddleEarthShadowOfWar, than replication of functions like OnPresent.

I removed them. Only the really needed few are there now.


Everything is finalizing for HDR, and it should compile now. (Included FSR src and libs too, though unused.)

I still haven't found why the DLSS bloom missing thing happens.

  • Discarding the TAA shader leads to similar (though even worse) missing FXs, obviously because output isn't written to.
  • (Still can't decomp TAA fully but) Letting TAA alpha return 0 or 1 doesn't change anything, at least I didn't notice any.
    I'd say just leave the toggle, just in case.

Also, I can combine down all the commits after you've read them

@XgarhontX

XgarhontX commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

@garamond13 If you build, can you check DLSS?
I'm pretty sure it's working, but I can't get the dev overlay to show, idk.

@garamond13

garamond13 commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

DLSS works fine for me.
Are you by any chance overriding DLSS with the Nvidia APP?

In shaders you have some .hlsl 1 files.
Luma already has some functions for color encode, decode, etc.

This may be bug with decompiler.
Original: movc r0.w, cb3[0].x, cb2[24].w, l(1.000000)
Decompiled: r0.w = !cb3[0].x ? cb2[24].w : 1;

Some UI suggestions.
ui suggestions

Also some UI settings are replicated in shader defines, is that avoidable?

@garamond13

garamond13 commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Strange I decompiled some other shader, and it looks correct.
3Dmigoto v1.3.16
0xE03893F6.ps_5_0.txt

Decompiled one more, more complex shader. It decompiled correctly.

@XgarhontX

XgarhontX commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

DLSS works fine for me. Are you by any chance overriding DLSS with the Nvidia APP?

  • It's always the goofy things... smh

In shaders you have some .hlsl 1 files.

  • Ok, I put them explicitly in a folder "Unused or Broken"

Luma already has some functions for color encode, decode, etc.

  • Yea, I'm now using them. (It's because I can never remember if it's gamma_srgb_to_linear or srgb_gamma_to_linear.)

This may be bug with decompiler. Original: movc r0.w, cb3[0].x, cb2[24].w, l(1.000000) Decompiled: r0.w = !cb3[0].x ? cb2[24].w : 1;

  • Yea, all the fire shaders has that. I think I added the ! for them, since it was inverted without.
  • Still, idk why TAA is not decompiling correctly. It never "anti-alias", like it always chooses new color.

Some UI suggestions.

  • Ok, I reworded almost all.
  • I want to keep TAA and 100% warning though. It's already on the lighter side. I was gonna make them colored & pulsing because I've had too many people ask help on why DLSS is not enabled for another mod.
  • Tab switching is fixed too. (Unpaired ImGui::PushID())
  • In HDR where there are couple more sections, I think they are warranted.

Also some UI settings are replicated in shader defines, is that avoidable?

  • I wanted it that way because from my other mods, people tend to completely miss or just dislike that screen.

Most Controversial Change

  • I fixed the missing bloom... somehow. It fixed alongside me accounting for Photo Mode's TAA without Motion Vectors shader. I suspect it's something with the SRV array and the Reset/Release, but idk. nvm, it didn't change anything...Photo Mode works though.
  • Now, Motion Vectors' resource is from the Linearize Depth shader's UAV1. That means there's an additional CSGetUnorderedAccessViews() and TAA's PSGetShaderResources() only gets scene color.

@XgarhontX

Copy link
Copy Markdown
Contributor Author
image

@XgarhontX

XgarhontX commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

I walked back on the UAV access since MVs generates on paused moving objects, which leads to artefacting.

Now, I'm just passing in a dummy black 1x1 texture for MVs while in Photo Mode.
It smears in movement, but that's not the point of Photo Mode anyways.

@XgarhontX

XgarhontX commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

Bruh... what. Metallic armor in rain is completely broken when Upgrade Samplers.
(Apparently, it's only on PUBLISHING for me. DEVELOPMENT works.)
image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants