Skip to content

Commit

Permalink
More semantic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
papadanku committed Feb 18, 2022
1 parent b694b8a commit 6934ee1
Show file tree
Hide file tree
Showing 25 changed files with 661 additions and 661 deletions.
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ kVignette | Natural vignetting effect

Practice | Variable
-------- | --------
Prefix `_` | Global objects and parameters
Prefix `_` | Global variables
Respectively suffix `VS` and `PS` | `PixelShader and VertexShader`
**ALLCAPS** | Semantics and state parameters
**Pascal_Case** | System-Value Semantics (`SV_Position`)
**PascalCase** | Namespaces, structs, methods, and local parameters
**PascalCase** | Namespaces, structs, methods, global objects, and local variables
**SNAKE_CASE** | Macros and preprocessor defines

## Acknowledgements
Expand Down
12 changes: 6 additions & 6 deletions shaders/cAbberation.fx
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ uniform float2 _ShiftBlue <
ui_type = "drag";
> = 1.0;

texture2D _RenderColor : COLOR;
texture2D RenderColor : COLOR;

sampler2D _SampleColor
sampler2D SampleColor
{
Texture = _RenderColor;
Texture = RenderColor;
MagFilter = LINEAR;
MinFilter = LINEAR;
MipFilter = LINEAR;
Expand All @@ -73,11 +73,11 @@ void AbberationPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOOR
{
const float2 PixelSize = float2(BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT);
// Shift red channel
OutputColor0.r = tex2D(_SampleColor, TexCoord + _ShiftRed * PixelSize).r;
OutputColor0.r = tex2D(SampleColor, TexCoord + _ShiftRed * PixelSize).r;
// Keep green channel to the center
OutputColor0.g = tex2D(_SampleColor, TexCoord + _ShiftGreen * PixelSize).g;
OutputColor0.g = tex2D(SampleColor, TexCoord + _ShiftGreen * PixelSize).g;
// Shift blue channel
OutputColor0.b = tex2D(_SampleColor, TexCoord + _ShiftBlue * PixelSize).b;
OutputColor0.b = tex2D(SampleColor, TexCoord + _ShiftBlue * PixelSize).b;
// Write alpha value
OutputColor0.a = 1.0;
}
Expand Down
20 changes: 10 additions & 10 deletions shaders/cAutoExposure.fx
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ uniform float _ManualBias <
ui_min = 0.0;
> = 2.0;

texture2D _RenderColor : COLOR;
texture2D RenderColor : COLOR;

sampler2D _SampleColor
sampler2D SampleColor
{
Texture = _RenderColor;
Texture = RenderColor;
MagFilter = LINEAR;
MinFilter = LINEAR;
MipFilter = LINEAR;
Expand All @@ -61,17 +61,17 @@ sampler2D _SampleColor
#endif
};

texture2D _RenderLumaLOD
texture2D RenderLumaLOD
{
Width = 256;
Height = 256;
MipLevels = 9;
Format = R16F;
};

sampler2D _SampleLumaLOD
sampler2D SampleLumaLOD
{
Texture = _RenderLumaLOD;
Texture = RenderLumaLOD;
MagFilter = LINEAR;
MinFilter = LINEAR;
MipFilter = LINEAR;
Expand All @@ -90,7 +90,7 @@ void PostProcessVS(in uint ID : SV_VertexID, out float4 Position : SV_Position,

void BlitPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0)
{
float4 Color = tex2D(_SampleColor, TexCoord);
float4 Color = tex2D(SampleColor, TexCoord);

// OutputColor.rgb = Output the highest brightness out of red/green/blue component
// OutputColor.a = Output the weight for temporal blending
Expand All @@ -100,8 +100,8 @@ void BlitPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, ou
void ExposurePS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float4 OutputColor0 : SV_Target0)
{
// Average Luma = Average value (1x1) for all of the pixels
float AverageLuma = tex2Dlod(_SampleLumaLOD, float4(TexCoord, 0.0, 8.0)).r;
float4 Color = tex2D(_SampleColor, TexCoord);
float AverageLuma = tex2Dlod(SampleLumaLOD, float4(TexCoord, 0.0, 8.0)).r;
float4 Color = tex2D(SampleColor, TexCoord);

// KeyValue is an exposure compensation curve
// Source: https://knarkowicz.wordpress.com/2016/01/09/automatic-exposure/
Expand All @@ -116,7 +116,7 @@ technique cAutoExposure
{
VertexShader = PostProcessVS;
PixelShader = BlitPS;
RenderTarget = _RenderLumaLOD;
RenderTarget = RenderLumaLOD;
ClearRenderTargets = FALSE;
BlendEnable = TRUE;
BlendOp = ADD;
Expand Down
Loading

0 comments on commit 6934ee1

Please sign in to comment.