Feedback on the HDR rendering option and how to fix it

Hello Crate Entertainment devs! It’s awesome that you guys are still going back in and adding new graphical features. I’d like to offer some feedback and suggestions regarding the new HDR rendering option.

For context about me and where this feedback is coming from, I’m a mod developer that works alongside other modders and some industry veterans. We reverse engineer games to add display HDR support and sometimes fix/alter the post processing pipeline in games.

It just so happens that I’d upgraded this game for HDR rendering, display HDR support, and SDR with tonemapping prior to this playtest, and would like to offer some feedback based on my experiences working on this.

I went in and decompiled the shaders again, and I see that you guys implemented Reinhard tonemapping by luminance. This is a bit of a problematic choice when you’re applying it after the fact to a game that was made with heavily clipped lighting. It will alter the way your effects are supposed to look, and can make lighting appear flat if a game wasn’t graded with it in mind. Reinhard is also a very aggressive tonemap for SDR, which further amplifies this problem.

My suggestion for adding tonemapping to a game that was already made with clipping from start to finish would be to use something with a high shoulder. Something like Hermite Spline. We’ve got some ready made code under the MIT license available here. I’d recommend running this per channel, with a somewhat low white clip (something in the 2-20 range). The low white clip will keep some of the same punch the game has normally, and running it per channel will give you the same kind of hues that clipping created before.

Here’s an Imgur gallery comparing the results

Thanks for taking the time to read this, and I hope the feedback is welcome.

12 Likes

In the event that anybody wants to check out the mod, it’s available here

Source code for this particular game mod is here

4 Likes

Thanks for the suggestions! We’ll definitely take a look at this.

7 Likes

Awesome! I hope you all do take this into consideration. The work these developers do for HDR is game changing in how the user experiences HDR in games. Specifically Renodx for Grim Dawn has been a joy to use with this game.

From a normal user myself with no HDR experience in coding the HDR Lighting option looks awful in its current state. For the minor performance hit you get enabling this option just to look terrible is not good. I hope you all can consider this suggestion to fix it.

Looks great and thank you for sharing your work. Are there options in game we need to disable to use this reshade mod? Or just install reshade, your mod and that’s it? :thinking:

Reshade with Addon support (it’s an Addon, not reshade effects).

If on the current test release of grim dawn, hdr rendering needs to be off. Anti aliasing also needs to be enabled (can be toggled in the mod).

There’s an SDR/HDR toggle in the mod, this is for display HDR. Both modes have HDR rendering.

1 Like

To add on to this, in the event that you guys wanted to add in Display HDR support to the game, I’d be more than happy to provide some guidance. Using the code we’ve developed, this is something that could be achieved natively in-engine with a very low time investment, and it would be best in class. We pride ourselves on our HDR work, and we make all of this stuff for free with the hope that it will permeate into shipping games and lift the quality of HDR implementations as a whole.

If this is something you’d like to explore, feel free to contact me in the personal messages on this board and we can go from there.

3 Likes

We have made adjustments to the HDR shader for the next build, check it out.

8 Likes

Saw the update came out, very nice.

There are some additional improvements I’d suggest, but this is a good performance conscious solution for SDR output without spending much more time on it (which is why I didn’t suggest more to begin with).

To elaborate though, ideally tone mapping would be the final stage in the post processing. This mostly works just fine with the way the post processing already works without additional modifications, but you’d have to do some scaling for the grading code. It’s not super expensive to do, but it is just more frametime spent to get a little extra quality out of the HDR rendering.

What I’m doing is creating a scale value with Reinhard, computed based on the max color channel of the untonemapped color. You can apply this scale to the color before it goes into grading, compute the grading code, and then inverse the scale afterwards. This will effectively apply the grading code onto the HDR image but with SDR constraints, without any of the hue shifting or clamping that comes from the per channel tone map (max channel is hue preserving, and you ideally want per channel desaturation/shift to be an output specific thing).

With that setup, you’d then run your tone mapping code after FXAA. Doing this would also have your game pretty much ready for a display HDR mode (which would be a nice to have on Steam Deck OLED btw!). Hermite Spline easily scales to an arbitrary peak. I realize this may not happen for this game, but maybe it’s useful information for a future project.

So from there it would just be upgrading the swapchain for HDR10 output, linearize by applying the inverse of 2.2 gamma (since the game never explicitly encodes in the first place), convert to BT2020 color space, apply brightness scaling (with a menu option), PQ Encode.

Brightness scaling is a linear multiplier in this instance. We choose to communicate it in terms of nits, so the menu option would be nits value, and you’d apply it by doing this: nits value / 80, which normalizes for SDR brightness and appropriately tracks display EOTF.

For the hermite spline peak target, you do: peak nits / brightness scale nits.

Scaling at the end of the chain mimics brightness scaling on a display in SDR, which is ideal behavior and matches what people are used to.

Dividing the peak target by the brightness scale ensures that peak remains consistent at output regardless of scaling factor.

We could get into more advanced stuff (separate UI/Game brightness scaling, perceptual space stuff for more consistent results across a variety of HDR displays, etc), but literally just doing this would already be a better quality HDR output than most games, to be completely honest.

If anybody on the team has a decent HDR display, I’d really like to encourage them to try out the mod so they can see what kind of a facelift the game gets from HDR. I’m biased but, I think it’s totally worth pursuing.

2 Likes

So HDR lighting means that the rendering is done in HDR but is then mapped to SDR for the final image? Is this just overall better than the normal rendering or mainly a question of preference? Should I select this option on an OLED monitor?

If I understood this right, I’d still like to see true HDR for the game btw.

Pretty much what you said. HDRA rendering is a pretty standard feature in modern rendering, it gets tone mapped down to SDR. With the updated tonemapping, it’s better than the non HDR for sure (highlights will look smoother basically).

The mod I made adds HDR output which would be great on your OLED.