Commit Graph

  • 47c2560476 Consolidated accumulate and accumulate+sharpen pipelines into a single pipeline, with the sharpening option being changed into a local keyword that can be enabled or disabled on-the-fly. This removes the need for an additional copy of the accumulate shader, which saves a considerable amount of memory. Nico de Poel 2023-06-05 15:57:02 +0200
  • 7798ae524c Added various controls for changing FSR2 settings at run-time Nico de Poel 2023-06-03 19:26:39 +0200
  • 65280ebf7a Further refinement to clarity and comments of the BiRP integration Nico de Poel 2023-06-03 18:52:12 +0200
  • ab635e30bd Synced readme with OSS repo Nico de Poel 2023-06-02 14:51:10 +0200
  • ff879b658d Reworked image effect integration, splitting things up into separate methods to improve readability and comprehension. Nico de Poel 2023-06-02 14:44:46 +0200
  • 4f0edf6049 Simplified a bunch of code and removed some unnecessary bits. Mipmap bias is applied more safely now. Context gets reset if auto exposure bool changes. Nico de Poel 2023-06-02 14:21:24 +0200
  • 5a0482f0bc Comments and tooltips Nico de Poel 2023-06-02 13:08:23 +0200
  • 537d96d3b6 Explicitly create and destroy the opaque-only RT before and after rendering, so that it remains valid throughout. Fixes the ESRAM-related visual jittering issue on Xbox One when auto-reactive or auto-TCR is enabled. Nico de Poel 2023-06-02 12:36:19 +0200
  • 20a6d4a057 Removed unnecessary HDRP keyword from two shaders Nico de Poel 2023-05-24 17:59:12 +0200
  • b136b864cd Updated README Nico de Poel 2023-05-24 17:49:09 +0200
  • 53e8164f0e Clear the atomic counter used by the luminance pyramid pass. This fixes auto-exposure being broken and causing a black screen on some platforms (Xbox, OpenGL). Nico de Poel 2023-05-24 15:38:13 +0200
  • 26cb485c30 Also use HDRP texture array workaround for opaque-only color input buffer Nico de Poel 2023-05-24 12:25:25 +0200
  • 501b1b0638 Added workaround for HDRP using texture arrays for its camera buffers on some platforms Nico de Poel 2023-05-24 11:46:59 +0200
  • 653b427c37 Commented out all experimental DXC-related pragmas, as these could sometimes cause shader compilation issues even when not enabled. Nico de Poel 2023-05-23 12:36:50 +0200
  • 8b3a1a7545 Implemented auto-TCR generation feature in BiRP integration example Nico de Poel 2023-05-17 17:23:02 +0200
  • ef20869c48 Added support for experimental auto-TCR generation pass Nico de Poel 2023-05-17 17:22:13 +0200
  • a2d670d0f8 Added a dummy field to the main FSR2 constant buffer, to make it exactly 128 bytes long. This fixes a data alignment issue on iOS Metal. Nico de Poel 2023-05-17 11:36:56 +0200
  • b1773de624 More textual fixes and corrections. Nico de Poel 2023-04-07 12:32:31 +0200
  • fad865f8bc Went back to HDR being derived from camera HDR settings. Maybe not entirely correct, but definitely less error prone. Nico de Poel 2023-04-07 12:32:07 +0200
  • 4ce471b4d8 More explanation and links Nico de Poel 2023-04-07 00:09:24 +0200
  • 6dbf4b69e2 Added checks to avoid problems when an invalid render size is used Nico de Poel 2023-04-06 18:32:13 +0200
  • bb0656c698 More textual changes and cropped the comparison image a bit Nico de Poel 2023-04-06 15:15:31 +0200
  • 490a76986c Enable HDR by default and clarified the tooltip somewhat Nico de Poel 2023-04-06 14:40:23 +0200
  • 4b07aaa4ae Added readme images, plus some minor textual changes and fixed links Nico de Poel 2023-04-06 14:30:29 +0200
  • e89676809e First draft of readme markdown text Nico de Poel 2023-04-06 14:04:29 +0200
  • 9f887a5c3c Check shader after loading it, throw an exception with a message on failure. This is better than having a random nullref happen, if the shaders cannot be loaded for whatever reason. Nico de Poel 2023-04-03 11:38:37 +0200
  • b1a7f48abb Made HDR into an explicit toggle that can be set by the application, rather than a best guess based on the camera settings Nico de Poel 2023-04-02 23:09:08 +0200
  • e335624ae1 Removed the backbuffer check, as it caused a false positive when a second overlay camera is active on top of the FSR2 output. Turns out blitting to an intermediate render texture works just fine if all FSR2 needs to do is output a color buffer. Nico de Poel 2023-03-30 13:12:37 +0200
  • 38cc3a83fd Don't validate input/output resources on reset, so the application has a way to prevent error messages when re-enabling a camera. In this situation, the previous frame won't have bound the required resources, leading to those errors. Now, if the application calls Reset() after re-enabling the camera, the error messages won't show. Nico de Poel 2023-03-30 12:06:34 +0200
  • 47d40fb71d More accurate representation of where SystemInfo.computeSubGroupSize is available Nico de Poel 2023-03-30 11:32:39 +0200
  • 8c95269c69 Added explanatory comments to the helper script Nico de Poel 2023-03-27 15:33:39 +0200
  • 0837aa50cb Removed the separate output color/depth render texture parameter, as it was very much redundant. Added help tooltips to each of the input parameters. Nico de Poel 2023-03-26 18:34:18 +0200
  • f38b37cb2d Changed DefaultFormat into a method and placed it next to the other helper methods Nico de Poel 2023-03-25 21:05:06 +0100
  • bfa9d5196a Made Callbacks into a property and just use rounding to int for dealing with floating point inaccuracies. Nico de Poel 2023-03-25 20:48:23 +0100
  • 73fa30927b Got rid of the global callbacks thing and made callbacks a local field of the Fsr2ImageEffect script. This way different applications of FSR2 within the same game can have different callbacks applied to them. For example: a camera for rendering a 3D UI image to a render texture can have callbacks to apply mipmap bias only to the assets being drawn for the UI. Nico de Poel 2023-03-25 16:06:19 +0100
  • f6da12c854 Brought back Ultra Quality mode (1.2x) scale, likely for good this time. It gets you about the same performance as native without AA, it has precedent in other games, it gives us nice symmetry with Ultra Performance mode, and it means the QualityMode enum is 0-based now. Nico de Poel 2023-03-25 14:20:51 +0100
  • 79046f40b3 Added a sample scene with two cameras, one upscaling and outputting to a render texture, the other applying post-FX and outputting to the display. Nico de Poel 2023-03-24 14:26:01 +0100
  • 644349b16b Respect output target texture's dimensions when determining render size and rescaling camera viewport. Nico de Poel 2023-03-24 14:23:29 +0100
  • 6f422fb35d Added plain MIT license text file Nico de Poel 2023-03-24 12:27:56 +0100
  • e0027ed77a Added MIT license header to every source file, similar to the FFX FSR2 codebase Nico de Poel 2023-03-24 12:20:45 +0100
  • 495350f569 Allow outputting to a user-provided color + depth buffer and optionally a motion vectors buffer. This can be used for passing the upscaled result to a different camera for additional post-processing and final output. Motion vectors aren't rescaled properly yet. Nico de Poel 2023-03-24 12:00:14 +0100
  • 1c030377c0 Reshufled some code so that if the initialization process fails for some reason, we don't leave the scene behind in a messed up state. Nico de Poel 2023-03-18 14:23:50 +0100
  • ce9a64cba5 Figured out a way to support cameras with target textures, that avoids errors about depth buffer mismatch. Nico de Poel 2023-03-18 14:15:14 +0100
  • 61a10cbd09 Updated project to Unity 2021.3.21f1 Nico de Poel 2023-03-17 14:59:28 +0100
  • 1cc0de7c89 Moved Shader ID constants to a separate class file Nico de Poel 2023-03-17 14:58:20 +0100
  • 1ff980bea9 Changing my mind yet again about directory names Nico de Poel 2023-03-17 14:46:32 +0100
  • 03fd58cb5a Check for compute shader support when enabling FSR2, and moved debug checking flag to default context creation method. Nico de Poel 2023-03-17 12:21:53 +0100
  • 0db7773ed9 Added a helper script to allow OnPreCull to happen at a different location in the camera stack from the image effect script. Also added a scene with PPV2 effects and FSR2 as post-PPV2 image effect to test and demonstrate this. Nico de Poel 2023-03-16 12:27:59 +0100
  • d02fc3cec1 Eliminated High Quality and Native modes again because you know what? AMD were right with their presets. Nico de Poel 2023-03-15 11:40:45 +0100
  • b190b2993c Suppress a few common but harmless warnings in FFX's HLSL code. This way we don't have to modify the FSR2 shaders to get rid of these warnings. Nico de Poel 2023-03-15 11:08:39 +0100
  • eaecd40cc4 Set default scale value to 0.5 as that seems to work better in multiple contexts Nico de Poel 2023-03-15 10:56:38 +0100
  • 06a2658080 More renaming Nico de Poel 2023-03-14 10:43:25 +0100
  • 3e31950d56 Changed Fsr2Callbacks into an interface + base implementation Nico de Poel 2023-03-13 17:45:09 +0100
  • da651c3d6f Moved some files Nico de Poel 2023-03-13 17:37:07 +0100
  • ee4d2d43ae Use render size for motion vector scale, since we are rendering them at lower resolution. Making this explicit takes away some recurring confusion. Nico de Poel 2023-03-10 17:54:47 +0100
  • d232e3e07b Removed separate command buffer for binding input buffers, which really wasn't needed anymore. Nico de Poel 2023-03-10 12:47:25 +0100
  • 279e294100 Replaced Post-Processing Stack V2 package from Unity repository with a local copy, so that we may make modifications to it Nico de Poel 2023-03-09 17:42:47 +0100
  • cd8b9965d2 Added ambient occlusion and color grading effects for testing purposes. Nico de Poel 2023-03-09 16:01:48 +0100
  • 178d9131af Implemented most of the FSR2 dispatch. It seems to be doing the right things in the background. Now its output just needs to be hacked into the PPV2 pipeline correctly. Nico de Poel 2023-03-09 15:59:04 +0100
  • d847999e44 Implemented remaining settings and parameters Nico de Poel 2023-03-09 15:21:01 +0100
  • 416b501c15 Implemented screen scaling through camera viewport manipulation, done through the helper's LateUpdate. This also led to some reorganization of variables and event ordering. Added some bloom to the post-process layer to test the cooperation between FSR2 and other post effects. Nico de Poel 2023-03-09 15:12:46 +0100
  • 6bc6d69fb4 Added initial implementation of post-processing stack effect for FSR2, with a new scene to test it in. This contains the results of a bunch of research so far, on where code gets executed and how to inject additional steps into the render loop. Nico de Poel 2023-03-09 13:57:30 +0100
  • f5cc64db94 Added Post-Processing Stack V2 package to the project Nico de Poel 2023-03-09 11:16:07 +0100
  • 05142da9ad Renamed Fsr2Controller to Fsr2ImageEffect, to make its purpose more clear. This is "only" a classic OnRenderImage effect, made to run as the final pass and to output directly to the backbuffer. Nico de Poel 2023-03-09 11:00:00 +0100
  • 0548c63800 Revert "Reintroduced the ability for FSR2 to output to a render texture again. Very basic for now." Nico de Poel 2023-03-09 10:47:37 +0100
  • 9352192f29 Enable HDR when the camera it set for it Nico de Poel 2023-03-08 16:35:33 +0100
  • bb24ed970b Reintroduced the ability for FSR2 to output to a render texture again. Very basic for now. Nico de Poel 2023-03-08 11:28:40 +0100
  • bcfb4b6769 Check for HDR when selecting RT formats for opaque-only and final output. This makes for fewer assumptions and should provide better support for HDR render paths. Nico de Poel 2023-03-08 10:43:59 +0100
  • e57cc0468d Moved exposure, reactive and T&C inputs to OnPreCull, to make OnRenderImage as clean and simple as possible. Nico de Poel 2023-03-08 10:31:56 +0100
  • 8668e0b3f6 Back to basics: allow FSR2 to only output directly to the backbuffer Nico de Poel 2023-03-06 15:13:00 +0100
  • 8575800995 Allow customization of pre-exposure and exposure inputs Nico de Poel 2023-03-06 13:25:25 +0100
  • 8cd818a3d9 A bit of comment cleanup Nico de Poel 2023-03-06 12:46:58 +0100
  • feb65ef9b3 Enable auto-exposure by default, which is what the FSR2 docs recommend. Nico de Poel 2023-03-06 11:45:00 +0100
  • 3ffbc0573e Implemented auto-exposure feature. The way this works: compute luminance always outputs an auto-exposure value. The passes using exposure as input can either use this auto-exposure, or use the default read-only exposure value, or use an application-provided exposure. Nico de Poel 2023-03-06 11:39:11 +0100
  • 21d939cfd4 Use original camera pixel width and height to determine display size, so that cameras with non-standard viewport rects will work too. Nico de Poel 2023-03-05 22:36:39 +0100
  • 341921bdda Perform camera scaling in OnPreCull, instead of OnPreRender. Fixed compatibility with post-FX executing OnPreRender before FSR2, and which retrieve camera resolution values to perform their rendering. For example: HBAO. Nico de Poel 2023-03-05 00:18:24 +0100
  • 9b83409c71 Added debug checks for input and output resources, either through direct assignment or through existing global texture bindings. Nico de Poel 2023-03-04 12:15:37 +0100
  • 92e360aa24 Implemented the debug checking upon dispatch from the original FSR2 source, with some Unity adaptations. Used this to good effect to fix a few small issues that had gone unnoticed. Also removed the Message callback which was kind of pointless, since Unity already has a well-established way of outputting warnings and errors. Nico de Poel 2023-03-04 11:40:31 +0100
  • 85829949f8 Made all inspector fields public, so that they can be easily accessed programmatically. There's really not much reason to keep these private, as we otherwise would have added public properties that directly access them anyway. Nico de Poel 2023-03-04 11:14:27 +0100
  • e78920a89c Disable DXC shader compiler by default because enabling it for DX12 will inevitably break DX11 support. Nico de Poel 2023-03-03 11:31:18 +0100
  • f429de28fb Enabled DXC shader compiler on supported platforms, and use it to enable native 16-bit and wave operations where possible. Moved common defines, pragmas and hacks into a new shared header file. Nico de Poel 2023-03-03 11:01:10 +0100
  • e5384a1b8b Let's call this High Quality instead of Ultra Quality. Ultra is a bit hyperbolic in this case. Nico de Poel 2023-03-02 20:28:36 +0100
  • 022eae95ef Added one more quality mode tier: ultra quality, which I felt was missing as an option. It maps nicely from 900p -> 1080p, 1200p -> 1440p, 1800p -> 4K, etc Nico de Poel 2023-03-02 12:48:45 +0100
  • 17cc461613 Allow reactive mask and T&C mask to be provided through the inspector Nico de Poel 2023-03-01 22:16:01 +0100
  • 8f1be6d3e6 Re-added transparency & composition parameter, even though we never use it and just fall back to the default reactivity mask, we officially support it as an input now. Nico de Poel 2023-03-01 22:09:18 +0100
  • eade3d40ce Moved generate reactive parameters up in the source file, so it's close to where it's being used. It felt very weird having it dangle off the bottom of the source file. Nico de Poel 2023-03-01 21:10:05 +0100
  • ec79c8ab24 Enable reactive mask generation by default Nico de Poel 2023-03-01 21:07:24 +0100
  • 54849cee0f Use RenderTargetIdentifier magic to bind UAV outputs to SRV inputs, making obsolete the monkey patching of shaders. Also reorganized the SRV/UAV names to match the ordering from the FSR2 source. Nico de Poel 2023-03-01 21:07:05 +0100
  • 69da937fd7 Added some seemingly sensible ranges to the reactive mask parameters. I really wish this stuff was a bit better explained and documented. Nico de Poel 2023-03-01 17:40:04 +0100
  • d5e17958d6 I do think we want to use the jittered projection matrix for transparent rendering. Otherwise the reactive mask's inputs do not match. Nico de Poel 2023-03-01 17:36:31 +0100
  • b7c49ea0e3 Allow reactive mask generation parameters to be set from the inspector. Also set a default quality mode and reintroduced the Native quality mode, to make FSR2 into an expensive TAA + sharpen. Nico de Poel 2023-03-01 17:33:05 +0100
  • 44c5f2847d Release opaque-only input RT as soon as we're done with it. This saves on aliasable memory used throughout the FSR2 process, and makes the extra cleanup pass afterward unnecessary. Nico de Poel 2023-03-01 17:08:37 +0100
  • e887db581b Capture opaque-only input just before the forward alpha rendering pass, so that opaque image effects like color grading don't affect the reactive mask. Nico de Poel 2023-03-01 16:13:28 +0100
  • 84b52c8853 Set non-jittered projection matrix before applying jittering, making motion vector jitter cancellation unnecessary. This should make outputting non-jittered upscaled depth and motion vectors for subsequent render passes a lot easier. Nico de Poel 2023-03-01 14:56:30 +0100
  • 070bd2704f Reordered inspector fields because I'm OCD like that Nico de Poel 2023-03-01 13:48:55 +0100
  • 9647805dcc Copy opaque-only render buffer to a temporary texture as input for the reactive mask generator, and clean up the RT after FSR2 is done. Generating the reactive mask now actually works and the difference is very noticeable in motion; much less artifacting on transparent effects. Nico de Poel 2023-03-01 12:52:57 +0100
  • 5ed7a5279b Progressed implementation of reactive mask generation pass. Added temporary RT to contain the generated reactive mask, bind it to the FSR2 inputs, and made it available as a toggle on the script. Nico de Poel 2023-03-01 12:04:18 +0100
  • 1364ace6b9 Re-enabled ESRAM for base Xbox One, and set some default resolutions for PS4/5 Nico de Poel 2023-02-28 18:55:16 +0100
  • d47b8c78da Added option to enable FP16 from the scene Nico de Poel 2023-02-28 18:51:35 +0100
  • 158d5bc176 Perform render scaling by manipulating the Camera viewport rect, which removes the need for a second game object and camera altogether. This eliminates the stupid full screen quad drawing that the second camera was doing, while also making the entire setup a lot simpler. Nico de Poel 2023-02-28 12:36:32 +0100