HDR Injector
Hi, friends.
That's it!
It's been about 3 years since my last blog post. A few things have happened in the mean time. I currently live in the SF bay (deep under the sea, biding my time) and work for Sony, doing PS4 graphics support. Cool. I'm not really going to talk about that today - just a quick catch up for those of you playing along at home.
I will talk about a little project I've been working on in my free time.
HDR basics
Fast forward. We currently live in the year 2018: a time of incredible power. The planet glows with unnatural energies and we're able to channel these Occult Phenomena directly into our eyes via Highe Dynamick Range televison and monitor devices.
The advantage of these devices is twofold:
- Enhanced brightness - things can be brighter, and show a more realistic range of brights/darks
- Wide color - you can show a wider range of colors. This is hard to describe if you haven't already seen it. It's astounding how good it can look.
Personally, I am extremely hyped about HDR. If you have access to one of these devices, you owe it to yourself to boot up The Witness on PS4 (no shilling- HDR in this game only works on PS4) and embrace the technicolor euphoria of modern Video Gaming.
I assume you are now convinced.
HDR on windows
HDR on windows is quite bad! You need the latest Windows 10, and a modern graphics card. After you have both of those, and an HDR display, you can connect it and turn it on. If you are lucky, you should be basking in the glow of 1000 nits of visible spectrum radiation. Enjoy your new suntan!
Oh wait, you wanted to do more stuff than just hurt your eyes on the Windows desktop? Well there's HDR Youtube. These videos will blow your mind out of your brain. Ok, cool, I dropped $2k on all this new gear to watch youtube videos? Yes, pretty much.
If you want to play some video games in HDR on windows, you have some limited options.
Final Fantasy XV
Dude, this game. It looks incredible, and performs inversely in proportion to how incredible it looks. 4k on a Titan Xp gets you about 20 fps. Thank glob for gsync.
Rating: 3 solar flares.
Assassin's Creed Origins
I didn't really notice wide color going on, but sometimes it gets bright.
Rating: 1.5 solar flares.
Obduction
Apparently this game has or had HDR support? Well, as of July 2018, it doesn't any more. If you go on the steam forums, they started out using NVAPI which was then deprecated, and now you just can't make HDR games using UE4. Cool!
Rating: N/A solar flares.
Overload
Does this game run in HDR? I think it might, but sources are unclear. It looks cool, and is really fun - but I prefer to play this game in VR. It's kind of weird how much better I am at this game in VR. On the same difficutly, using the same controls, I can easily complete a level in VR that would otherwise kill me over and over in pancake. It's too bad that the Oculus can't burn out your retinas just yet.
Rating: 2 solar flares.
The Witness
Sorry, this one doesn't run in HDR on windows. If you want HDR you have to play it on PS4.
OR use this... thing...
HDR Injector
I'm making this thing called the HDR Injector. Here's the Github. It's not even close to finished. It's currently a fork of ReShade (but I expect it to diverge greatly) that does 3 things. Before describing those things, I will give you the motivation behind this project.
Here's a surprise: most games since the mid 2000's already render in HDR! They need to do this so that they can calculate physically based lighting values correctly. Basically, all these modern games already have an HDR buffer lying around, but it gets tonemapped down to 8 bits for displaying on nomral SDR screens. Wouldn't it be cool if we could somehow get a hold of those HDR buffers and show them on screen? Well, that is what my tool does.
The three parts:
- Find HDR buffers using some heuristics and user input.
- Post-process these buffers into Rec2020 colorspace, and do PQ encoding. (basically, turn them into actual buffers that HDR monitors can display)
- Create an HDR swapchain and present the post-processed HDR buffer.
The cool thing is that it already does most of this. just in a hardcoded and unreliable way. When tested on The Witness, I think it looks about 30% as good as it does on PS4, which means there is still quite a way to go.
An incomplete list of unaddressed issues:
- You have to hardcode the HDR backbuffer index.
- My current gamut expansion method sux and looks like garbage. It's literally just stretching the Rec709 primaries to be Rec2020 primaries
- Uh, well, at least in the witness, UI comes after tonemapping, so we're kind of screwed for actually playing the game. I have some ideas for how to fix this. Perhaps injecting luminance into the final buffer based on some comparison operator
- Once you enable the HDR injector, you can't disable it (or rather you can, but the game stops presenting new frames). I don't know why this happens but I haven't looked too much into it.
Uh, probably don't download, or try to build it just yet. Hit me up on the tweeto @pyromuffin if you got any questions, comments, hate-mail, sexts, etc.
That's it!
XOXO
Kelly
One player selects a number and records it on a piece of paper. coolmath-games
ReplyDelete