Skip to content

Commit 6251227

Browse files
MikhailGorobetsTheMostDiligent
authored andcommitted
Tutorial27_PostProcessing: Added FSR
1 parent 5bad845 commit 6251227

File tree

6 files changed

+217
-68
lines changed

6 files changed

+217
-68
lines changed

Tutorials/Tutorial27_PostProcessing/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ set(SHADERS
2020
assets/shaders/GenerateGeometry.psh
2121
assets/shaders/ComputeLighting.fx
2222
assets/shaders/ApplyToneMap.fx
23+
assets/shaders/GammaCorrection.fx
2324
)
2425

2526
set(TEXTURES

Tutorials/Tutorial27_PostProcessing/assets/shaders/ApplyToneMap.fx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include "FullScreenTriangleVSOutput.fxh"
22
#include "PBR_Structures.fxh"
33
#include "ToneMapping.fxh"
4-
#include "SRGBUtilities.fxh"
54

65
cbuffer cbPBRRendererAttibs
76
{
@@ -22,9 +21,5 @@ float4 ApplyToneMapPS(FullScreenTriangleVSOutput VSOut) : SV_Target0
2221

2322
float3 HDRColor = g_TextureHDR.Load(int3(VSOut.f4PixelPos.xy, 0));
2423
float3 SDRColor = ToneMap(HDRColor, TMAttribs, g_PBRRendererAttibs.AverageLogLum);
25-
26-
#if CONVERT_OUTPUT_TO_SRGB
27-
SDRColor = LinearToSRGB(SDRColor);
28-
#endif
2924
return float4(SDRColor, 1.0);
3025
}

Tutorials/Tutorial27_PostProcessing/assets/shaders/ComputeLighting.fx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ struct SurfaceInformation
4141
float3 Normal;
4242
};
4343

44-
float3 FresnelSchlickRoughness(float CosTheta, float3 F0, float roughness)
44+
float3 FresnelSchlickRoughness(float CosTheta, float3 F0, float Roughness)
4545
{
46-
float Alpha = 1.0 - roughness;
46+
float Alpha = 1.0 - Roughness;
4747
return F0 + (max(float3(Alpha, Alpha, Alpha), F0) - F0) * pow(clamp(1.0 - CosTheta, 0.0, 1.0), 5.0);
4848
}
4949

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include "FullScreenTriangleVSOutput.fxh"
2+
#include "SRGBUtilities.fxh"
3+
4+
Texture2D<float3> g_TextureColor;
5+
SamplerState g_TextureColor_sampler;
6+
7+
float4 GammaCorrectionPS(FullScreenTriangleVSOutput VSOut) : SV_Target0
8+
{
9+
float2 Texcoord = NormalizedDeviceXYToTexUV(VSOut.f2NormalizedXY.xy);
10+
float3 GammaColor = LinearToSRGB(g_TextureColor.SampleLevel(g_TextureColor_sampler, Texcoord, 0.0));
11+
return float4(GammaColor, 1.0);
12+
}

0 commit comments

Comments
 (0)