Nico de Poel
b1a7f48abb
Made HDR into an explicit toggle that can be set by the application, rather than a best guess based on the camera settings
3 years ago
Nico de Poel
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.
3 years ago
Nico de Poel
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.
3 years ago
Nico de Poel
f38b37cb2d
Changed DefaultFormat into a method and placed it next to the other helper methods
3 years ago
Nico de Poel
bfa9d5196a
Made Callbacks into a property and just use rounding to int for dealing with floating point inaccuracies.
3 years ago
Nico de Poel
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.
3 years ago
Nico de Poel
644349b16b
Respect output target texture's dimensions when determining render size and rescaling camera viewport.
3 years ago
Nico de Poel
e0027ed77a
Added MIT license header to every source file, similar to the FFX FSR2 codebase
3 years ago
Nico de Poel
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.
3 years ago
Nico de Poel
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.
3 years ago
Nico de Poel
ce9a64cba5
Figured out a way to support cameras with target textures, that avoids errors about depth buffer mismatch.
3 years ago
Nico de Poel
1cc0de7c89
Moved Shader ID constants to a separate class file
3 years ago
Nico de Poel
03fd58cb5a
Check for compute shader support when enabling FSR2, and moved debug checking flag to default context creation method.
3 years ago
Nico de Poel
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.
3 years ago
Nico de Poel
eaecd40cc4
Set default scale value to 0.5 as that seems to work better in multiple contexts
3 years ago
Nico de Poel
ee4d2d43ae
Use render size for motion vector scale, since we are rendering them at lower resolution.
Making this explicit takes away some recurring confusion.
3 years ago
Nico de Poel
d232e3e07b
Removed separate command buffer for binding input buffers, which really wasn't needed anymore.
3 years ago
Nico de Poel
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.
3 years ago
Nico de Poel
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.
3 years ago
Nico de Poel
0548c63800
Revert "Reintroduced the ability for FSR2 to output to a render texture again. Very basic for now."
This reverts commit bb24ed970b .
3 years ago
Nico de Poel
9352192f29
Enable HDR when the camera it set for it
3 years ago
Nico de Poel
bb24ed970b
Reintroduced the ability for FSR2 to output to a render texture again. Very basic for now.
3 years ago
Nico de Poel
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.
3 years ago
Nico de Poel
e57cc0468d
Moved exposure, reactive and T&C inputs to OnPreCull, to make OnRenderImage as clean and simple as possible.
3 years ago
Nico de Poel
8668e0b3f6
Back to basics: allow FSR2 to only output directly to the backbuffer
3 years ago
Nico de Poel
8575800995
Allow customization of pre-exposure and exposure inputs
3 years ago
Nico de Poel
feb65ef9b3
Enable auto-exposure by default, which is what the FSR2 docs recommend.
3 years ago
Nico de Poel
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.
3 years ago
Nico de Poel
21d939cfd4
Use original camera pixel width and height to determine display size, so that cameras with non-standard viewport rects will work too.
3 years ago
Nico de Poel
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.
3 years ago
Nico de Poel
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.
3 years ago
Nico de Poel
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.
3 years ago
Nico de Poel
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
3 years ago
Nico de Poel
17cc461613
Allow reactive mask and T&C mask to be provided through the inspector
3 years ago
Nico de Poel
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.
3 years ago
Nico de Poel
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.
3 years ago
Nico de Poel
69da937fd7
Added some seemingly sensible ranges to the reactive mask parameters.
I really wish this stuff was a bit better explained and documented.
3 years ago
Nico de Poel
d5e17958d6
I do think we want to use the jittered projection matrix for transparent rendering. Otherwise the reactive mask's inputs do not match.
3 years ago
Nico de Poel
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.
3 years ago
Nico de Poel
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.
3 years ago
Nico de Poel
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.
3 years ago
Nico de Poel
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.
3 years ago
Nico de Poel
070bd2704f
Reordered inspector fields because I'm OCD like that
3 years ago
Nico de Poel
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.
3 years ago
Nico de Poel
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.
3 years ago
Nico de Poel
d47b8c78da
Added option to enable FP16 from the scene
3 years ago
Nico de Poel
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.
3 years ago
Nico de Poel
c1326fc261
Added some comments to the main FSR2 classes
3 years ago
Nico de Poel
62d1d41d2d
Stripped Fsr2Dispatcher of most of its functionality, and moved it over to Fsr2Controller
3 years ago
Nico de Poel
a9997e1a02
Moved Fsr2Dispatcher into Fsr2Controller source file and made it internal. Placed everything into the FidelityFX namespace.
3 years ago